diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/tests.py')
| -rw-r--r-- | bitbake/lib/toaster/toastergui/tests.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py index d278d63aa1..c725fc827d 100644 --- a/bitbake/lib/toaster/toastergui/tests.py +++ b/bitbake/lib/toaster/toastergui/tests.py | |||
| @@ -38,6 +38,7 @@ import json | |||
| 38 | import re | 38 | import re |
| 39 | 39 | ||
| 40 | PROJECT_NAME = "test project" | 40 | PROJECT_NAME = "test project" |
| 41 | CLI_BUILDS_PROJECT_NAME = 'Command line builds' | ||
| 41 | 42 | ||
| 42 | class ViewTests(TestCase): | 43 | class ViewTests(TestCase): |
| 43 | """Tests to verify view APIs.""" | 44 | """Tests to verify view APIs.""" |
| @@ -658,6 +659,12 @@ class AllBuildsPageTests(TestCase): | |||
| 658 | bitbake_version=bbv) | 659 | bitbake_version=bbv) |
| 659 | self.project1 = Project.objects.create_project(name=PROJECT_NAME, | 660 | self.project1 = Project.objects.create_project(name=PROJECT_NAME, |
| 660 | release=release) | 661 | release=release) |
| 662 | self.default_project = Project.objects.create_project( | ||
| 663 | name=CLI_BUILDS_PROJECT_NAME, | ||
| 664 | release=release | ||
| 665 | ) | ||
| 666 | self.default_project.is_default = True | ||
| 667 | self.default_project.save() | ||
| 661 | 668 | ||
| 662 | # parameters for builds to associate with the projects | 669 | # parameters for builds to associate with the projects |
| 663 | now = timezone.now() | 670 | now = timezone.now() |
| @@ -669,6 +676,13 @@ class AllBuildsPageTests(TestCase): | |||
| 669 | "outcome": Build.SUCCEEDED | 676 | "outcome": Build.SUCCEEDED |
| 670 | } | 677 | } |
| 671 | 678 | ||
| 679 | self.default_project_build_success = { | ||
| 680 | "project": self.default_project, | ||
| 681 | "started_on": now, | ||
| 682 | "completed_on": now, | ||
| 683 | "outcome": Build.SUCCEEDED | ||
| 684 | } | ||
| 685 | |||
| 672 | def test_show_tasks_in_allbuilds(self): | 686 | def test_show_tasks_in_allbuilds(self): |
| 673 | """ Task should be shown as suffix on build name """ | 687 | """ Task should be shown as suffix on build name """ |
| 674 | build = Build.objects.create(**self.project1_build_success) | 688 | build = Build.objects.create(**self.project1_build_success) |
| @@ -678,6 +692,23 @@ class AllBuildsPageTests(TestCase): | |||
| 678 | result = re.findall('bash:clean', response.content, re.MULTILINE) | 692 | result = re.findall('bash:clean', response.content, re.MULTILINE) |
| 679 | self.assertEqual(len(result), 3) | 693 | self.assertEqual(len(result), 3) |
| 680 | 694 | ||
| 695 | def test_no_run_again_for_cli_build(self): | ||
| 696 | """ "Run again" button should not be shown for command-line builds """ | ||
| 697 | build = Build.objects.create(**self.default_project_build_success) | ||
| 698 | url = reverse("all-builds") | ||
| 699 | response = self.client.get(url, follow=True) | ||
| 700 | soup = BeautifulSoup(response.content) | ||
| 701 | |||
| 702 | element_id = 'build-result-%d' % build.id | ||
| 703 | |||
| 704 | # shouldn't see a run again button for command-line builds | ||
| 705 | run_again_button = soup.select('#%s button' % element_id) | ||
| 706 | self.assertEqual(len(run_again_button), 0) | ||
| 707 | |||
| 708 | # should see a help icon for command-line builds | ||
| 709 | help_icon = soup.select('#%s i.get-help-green' % element_id) | ||
| 710 | self.assertEqual(len(help_icon), 1) | ||
| 711 | |||
| 681 | class ProjectPageTests(TestCase): | 712 | class ProjectPageTests(TestCase): |
| 682 | """ Test project data at /project/X/ is displayed correctly """ | 713 | """ Test project data at /project/X/ is displayed correctly """ |
| 683 | CLI_BUILDS_PROJECT_NAME = 'Command line builds' | 714 | CLI_BUILDS_PROJECT_NAME = 'Command line builds' |
| @@ -707,3 +738,5 @@ class ProjectPageTests(TestCase): | |||
| 707 | response = self.client.get(url, follow=True) | 738 | response = self.client.get(url, follow=True) |
| 708 | 739 | ||
| 709 | self.assertEqual(response.status_code, 200) | 740 | self.assertEqual(response.status_code, 200) |
| 741 | |||
| 742 | |||
