diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/tests.py')
| -rw-r--r-- | bitbake/lib/toaster/toastergui/tests.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py index 3753748b75..4b93415e1e 100644 --- a/bitbake/lib/toaster/toastergui/tests.py +++ b/bitbake/lib/toaster/toastergui/tests.py | |||
| @@ -596,8 +596,18 @@ class ProjectBuildsPageTests(TestCase): | |||
| 596 | bitbake_version=bbv) | 596 | bitbake_version=bbv) |
| 597 | self.project1 = Project.objects.create_project(name=PROJECT_NAME, | 597 | self.project1 = Project.objects.create_project(name=PROJECT_NAME, |
| 598 | release=release) | 598 | release=release) |
| 599 | self.project1.save() | ||
| 600 | |||
| 599 | self.project2 = Project.objects.create_project(name=PROJECT_NAME, | 601 | self.project2 = Project.objects.create_project(name=PROJECT_NAME, |
| 600 | release=release) | 602 | release=release) |
| 603 | self.project2.save() | ||
| 604 | |||
| 605 | self.default_project = Project.objects.create_project( | ||
| 606 | name=CLI_BUILDS_PROJECT_NAME, | ||
| 607 | release=release | ||
| 608 | ) | ||
| 609 | self.default_project.is_default = True | ||
| 610 | self.default_project.save() | ||
| 601 | 611 | ||
| 602 | # parameters for builds to associate with the projects | 612 | # parameters for builds to associate with the projects |
| 603 | now = timezone.now() | 613 | now = timezone.now() |
| @@ -630,6 +640,13 @@ class ProjectBuildsPageTests(TestCase): | |||
| 630 | "outcome": Build.IN_PROGRESS | 640 | "outcome": Build.IN_PROGRESS |
| 631 | } | 641 | } |
| 632 | 642 | ||
| 643 | self.default_project_build_success = { | ||
| 644 | "project": self.default_project, | ||
| 645 | "started_on": now, | ||
| 646 | "completed_on": now, | ||
| 647 | "outcome": Build.SUCCEEDED | ||
| 648 | } | ||
| 649 | |||
| 633 | def _get_rows_for_project(self, project_id): | 650 | def _get_rows_for_project(self, project_id): |
| 634 | """ Helper to retrieve HTML rows for a project """ | 651 | """ Helper to retrieve HTML rows for a project """ |
| 635 | url = reverse("projectbuilds", args=(project_id,)) | 652 | url = reverse("projectbuilds", args=(project_id,)) |
| @@ -681,6 +698,30 @@ class ProjectBuildsPageTests(TestCase): | |||
| 681 | result = re.findall('^ +bash:clean$', response.content, re.MULTILINE) | 698 | result = re.findall('^ +bash:clean$', response.content, re.MULTILINE) |
| 682 | self.assertEqual(len(result), 2) | 699 | self.assertEqual(len(result), 2) |
| 683 | 700 | ||
| 701 | def test_cli_builds_hides_tabs(self): | ||
| 702 | """ | ||
| 703 | Display for command line builds should hide tabs; | ||
| 704 | note that the latest builds section is already tested in | ||
| 705 | AllBuildsPageTests, as the template is the same | ||
| 706 | """ | ||
| 707 | url = reverse("projectbuilds", args=(self.default_project.id,)) | ||
| 708 | response = self.client.get(url, follow=True) | ||
| 709 | soup = BeautifulSoup(response.content) | ||
| 710 | tabs = soup.select('#project-topbar') | ||
| 711 | self.assertEqual(len(tabs), 0, | ||
| 712 | 'should be no top bar shown for command line builds') | ||
| 713 | |||
| 714 | def test_non_cli_builds_has_tabs(self): | ||
| 715 | """ | ||
| 716 | Non-command-line builds projects should show the tabs | ||
| 717 | """ | ||
| 718 | url = reverse("projectbuilds", args=(self.project1.id,)) | ||
| 719 | response = self.client.get(url, follow=True) | ||
| 720 | soup = BeautifulSoup(response.content) | ||
| 721 | tabs = soup.select('#project-topbar') | ||
| 722 | self.assertEqual(len(tabs), 1, | ||
| 723 | 'should be a top bar shown for non-command-line builds') | ||
| 724 | |||
| 684 | class AllBuildsPageTests(TestCase): | 725 | class AllBuildsPageTests(TestCase): |
| 685 | """ Tests for all builds page /builds/ """ | 726 | """ Tests for all builds page /builds/ """ |
| 686 | 727 | ||
