diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/tests.py')
| -rw-r--r-- | bitbake/lib/toaster/toastergui/tests.py | 38 |
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 | ||
| 431 | class ProjectsPageTests(TestCase): | 431 | class 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 | |||
| 557 | class ProjectBuildsPageTests(TestCase): | 589 | class 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 | ||
| 652 | class AllBuildsPageTests(TestCase): | 684 | class 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/", |
