summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/toastergui/tests.py')
-rw-r--r--bitbake/lib/toaster/toastergui/tests.py40
1 files changed, 33 insertions, 7 deletions
diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py
index 4b93415e1e..69bbfd43e4 100644
--- a/bitbake/lib/toaster/toastergui/tests.py
+++ b/bitbake/lib/toaster/toastergui/tests.py
@@ -760,7 +760,7 @@ class AllBuildsPageTests(TestCase):
760 """ Task should be shown as suffix on build name """ 760 """ Task should be shown as suffix on build name """
761 build = Build.objects.create(**self.project1_build_success) 761 build = Build.objects.create(**self.project1_build_success)
762 Target.objects.create(build=build, target='bash', task='clean') 762 Target.objects.create(build=build, target='bash', task='clean')
763 url = reverse("all-builds") 763 url = reverse('all-builds')
764 response = self.client.get(url, follow=True) 764 response = self.client.get(url, follow=True)
765 result = re.findall('bash:clean', response.content, re.MULTILINE) 765 result = re.findall('bash:clean', response.content, re.MULTILINE)
766 self.assertEqual(len(result), 3) 766 self.assertEqual(len(result), 3)
@@ -768,20 +768,48 @@ class AllBuildsPageTests(TestCase):
768 def test_no_run_again_for_cli_build(self): 768 def test_no_run_again_for_cli_build(self):
769 """ "Run again" button should not be shown for command-line builds """ 769 """ "Run again" button should not be shown for command-line builds """
770 build = Build.objects.create(**self.default_project_build_success) 770 build = Build.objects.create(**self.default_project_build_success)
771 url = reverse("all-builds") 771 url = reverse('all-builds')
772 response = self.client.get(url, follow=True) 772 response = self.client.get(url, follow=True)
773 soup = BeautifulSoup(response.content) 773 soup = BeautifulSoup(response.content)
774 774
775 element_id = 'build-result-%d' % build.id 775 attrs = {'data-latest-build-result': build.id}
776 result = soup.find('div', attrs=attrs)
776 777
777 # shouldn't see a run again button for command-line builds 778 # shouldn't see a run again button for command-line builds
778 run_again_button = soup.select('#%s button' % element_id) 779 run_again_button = result.select('button')
779 self.assertEqual(len(run_again_button), 0) 780 self.assertEqual(len(run_again_button), 0)
780 781
781 # should see a help icon for command-line builds 782 # should see a help icon for command-line builds
782 help_icon = soup.select('#%s i.get-help-green' % element_id) 783 help_icon = result.select('i.get-help-green')
783 self.assertEqual(len(help_icon), 1) 784 self.assertEqual(len(help_icon), 1)
784 785
786 def test_tooltips_on_project_name(self):
787 """
788 A tooltip should be present next to the command line
789 builds project name in the all builds page, but not for
790 other projects
791 """
792 build1 = Build.objects.create(**self.project1_build_success)
793 default_build = Build.objects.create(**self.default_project_build_success)
794
795 url = reverse('all-builds')
796 response = self.client.get(url, follow=True)
797 soup = BeautifulSoup(response.content)
798
799 # no help icon on non-default project name
800 result = soup.find('tr', attrs={'data-table-build-result': build1.id})
801 name = result.select('td.project-name')[0]
802 icons = name.select('i.get-help')
803 self.assertEqual(len(icons), 0,
804 'should not be a help icon for non-cli builds name')
805
806 # help icon on default project name
807 result = soup.find('tr', attrs={'data-table-build-result': default_build.id})
808 name = result.select('td.project-name')[0]
809 icons = name.select('i.get-help')
810 self.assertEqual(len(icons), 1,
811 'should be a help icon for cli builds name')
812
785class ProjectPageTests(TestCase): 813class ProjectPageTests(TestCase):
786 """ Test project data at /project/X/ is displayed correctly """ 814 """ Test project data at /project/X/ is displayed correctly """
787 CLI_BUILDS_PROJECT_NAME = 'Command line builds' 815 CLI_BUILDS_PROJECT_NAME = 'Command line builds'
@@ -811,5 +839,3 @@ class ProjectPageTests(TestCase):
811 response = self.client.get(url, follow=True) 839 response = self.client.get(url, follow=True)
812 840
813 self.assertEqual(response.status_code, 200) 841 self.assertEqual(response.status_code, 200)
814
815