summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/tests.py
diff options
context:
space:
mode:
authorElliot Smith <elliot.smith@intel.com>2015-10-02 08:14:42 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-16 14:59:59 +0100
commitda4c6144f1125ac94f1ba515f97a433a983b7662 (patch)
tree09f40037ea1bf5eca452d648aeeb8fa070540a9a /bitbake/lib/toaster/toastergui/tests.py
parentef6fc2bc1a4eeafdf5eda112ffb72bfed24b85d5 (diff)
downloadpoky-da4c6144f1125ac94f1ba515f97a433a983b7662.tar.gz
bitbake: toaster: Make the builds view the project page for "command line builds"
Command line builds don't have configuration or layers which can be manipulated in Toaster, so these pages shouldn't be visible. However, the configuration page is the default page for the project view (/project/X/), which isn't correct for the command line builds project. Modify all project page links across the application so that the command line builds project (aka the "default" project) always displays the builds tab. Add a project_url tag for templates which contains the logic determining where the URL for a project links to, based on whether it is the default project or not. [YOCTO #8231] (Bitbake rev: 3ea10f4c16a557e94781251f6776b13acb8e9eba) Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/tests.py')
-rw-r--r--bitbake/lib/toaster/toastergui/tests.py38
1 files changed, 35 insertions, 3 deletions
diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py
index c725fc827d..3753748b75 100644
--- a/bitbake/lib/toaster/toastergui/tests.py
+++ b/bitbake/lib/toaster/toastergui/tests.py
@@ -428,8 +428,8 @@ class LandingPageTests(TestCase):
428 self.assertTrue('/builds' in response.url, 428 self.assertTrue('/builds' in response.url,
429 'should redirect to builds') 429 'should redirect to builds')
430 430
431class ProjectsPageTests(TestCase): 431class AllProjectsPageTests(TestCase):
432 """ Tests for projects page """ 432 """ Tests for projects page /projects/ """
433 433
434 MACHINE_NAME = 'delorean' 434 MACHINE_NAME = 'delorean'
435 435
@@ -554,6 +554,38 @@ class ProjectsPageTests(TestCase):
554 self.assertEqual(text, self.MACHINE_NAME, 554 self.assertEqual(text, self.MACHINE_NAME,
555 'machine name should be shown for non-default project') 555 'machine name should be shown for non-default project')
556 556
557 def test_project_page_links(self):
558 """
559 Test that links for the default project point to the builds
560 page /projects/X/builds for that project, and that links for
561 other projects point to their configuration pages /projects/X/
562 """
563
564 # need a build, otherwise project doesn't display at all
565 self._add_build_to_default_project()
566
567 # another project to test, which should show machine
568 self._add_non_default_project()
569
570 response = self.client.get(reverse('all-projects'), follow=True)
571 soup = BeautifulSoup(response.content)
572
573 # link for default project
574 row = soup.find('tr', attrs={'data-project': self.default_project.id})
575 cell = row.find('td', attrs={'data-project-field': 'name'})
576 url = cell.find('a')['href']
577 expected_url = reverse('projectbuilds', args=(self.default_project.id,))
578 self.assertEqual(url, expected_url,
579 'link on default project name should point to builds')
580
581 # link for other project
582 row = soup.find('tr', attrs={'data-project': self.project.id})
583 cell = row.find('td', attrs={'data-project-field': 'name'})
584 url = cell.find('a')['href']
585 expected_url = reverse('project', args=(self.project.id,))
586 self.assertEqual(url, expected_url,
587 'link on project name should point to configuration')
588
557class ProjectBuildsPageTests(TestCase): 589class ProjectBuildsPageTests(TestCase):
558 """ Test data at /project/X/builds is displayed correctly """ 590 """ Test data at /project/X/builds is displayed correctly """
559 591
@@ -650,7 +682,7 @@ class ProjectBuildsPageTests(TestCase):
650 self.assertEqual(len(result), 2) 682 self.assertEqual(len(result), 2)
651 683
652class AllBuildsPageTests(TestCase): 684class AllBuildsPageTests(TestCase):
653 """ Tests for all builds page """ 685 """ Tests for all builds page /builds/ """
654 686
655 def setUp(self): 687 def setUp(self):
656 bbv = BitbakeVersion.objects.create(name="bbv1", giturl="/tmp/", 688 bbv = BitbakeVersion.objects.create(name="bbv1", giturl="/tmp/",