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.py133
1 files changed, 0 insertions, 133 deletions
diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py
index 78b7c04255..7192947326 100644
--- a/bitbake/lib/toaster/toastergui/tests.py
+++ b/bitbake/lib/toaster/toastergui/tests.py
@@ -764,139 +764,6 @@ class AllProjectsPageTests(TestCase):
764 self.assertEqual(soup.find('a')['href'], expected_url, 764 self.assertEqual(soup.find('a')['href'], expected_url,
765 'link on project name should point to configuration') 765 'link on project name should point to configuration')
766 766
767class ProjectBuildsPageTests(TestCase):
768 """ Test data at /project/X/builds is displayed correctly """
769
770 def setUp(self):
771 bbv = BitbakeVersion.objects.create(name="bbv1", giturl="/tmp/",
772 branch="master", dirpath="")
773 release = Release.objects.create(name="release1",
774 bitbake_version=bbv)
775 self.project1 = Project.objects.create_project(name=PROJECT_NAME,
776 release=release)
777 self.project1.save()
778
779 self.project2 = Project.objects.create_project(name=PROJECT_NAME,
780 release=release)
781 self.project2.save()
782
783 self.default_project = Project.objects.create_project(
784 name=CLI_BUILDS_PROJECT_NAME,
785 release=release
786 )
787 self.default_project.is_default = True
788 self.default_project.save()
789
790 # parameters for builds to associate with the projects
791 now = timezone.now()
792
793 self.project1_build_success = {
794 "project": self.project1,
795 "started_on": now,
796 "completed_on": now,
797 "outcome": Build.SUCCEEDED
798 }
799
800 self.project1_build_in_progress = {
801 "project": self.project1,
802 "started_on": now,
803 "completed_on": now,
804 "outcome": Build.IN_PROGRESS
805 }
806
807 self.project2_build_success = {
808 "project": self.project2,
809 "started_on": now,
810 "completed_on": now,
811 "outcome": Build.SUCCEEDED
812 }
813
814 self.project2_build_in_progress = {
815 "project": self.project2,
816 "started_on": now,
817 "completed_on": now,
818 "outcome": Build.IN_PROGRESS
819 }
820
821 def _get_rows_for_project(self, project_id):
822 """ Helper to retrieve HTML rows for a project """
823 url = reverse("projectbuilds", args=(project_id,))
824 response = self.client.get(url, {'format': 'json'}, follow=True)
825 data = json.loads(response.content)
826 return data['rows']
827
828 def test_show_builds_for_project(self):
829 """ Builds for a project should be displayed """
830 Build.objects.create(**self.project1_build_success)
831 Build.objects.create(**self.project1_build_success)
832 build_rows = self._get_rows_for_project(self.project1.id)
833 self.assertEqual(len(build_rows), 2)
834
835 def test_show_builds_project_only(self):
836 """ Builds for other projects should be excluded """
837 Build.objects.create(**self.project1_build_success)
838 Build.objects.create(**self.project1_build_success)
839 Build.objects.create(**self.project1_build_success)
840
841 # shouldn't see these two
842 Build.objects.create(**self.project2_build_success)
843 Build.objects.create(**self.project2_build_in_progress)
844
845 build_rows = self._get_rows_for_project(self.project1.id)
846 self.assertEqual(len(build_rows), 3)
847
848 def test_builds_exclude_in_progress(self):
849 """ "in progress" builds should not be shown """
850 Build.objects.create(**self.project1_build_success)
851 Build.objects.create(**self.project1_build_success)
852
853 # shouldn't see this one
854 Build.objects.create(**self.project1_build_in_progress)
855
856 # shouldn't see these two either, as they belong to a different project
857 Build.objects.create(**self.project2_build_success)
858 Build.objects.create(**self.project2_build_in_progress)
859
860 build_rows = self._get_rows_for_project(self.project1.id)
861 self.assertEqual(len(build_rows), 2)
862
863 def test_tasks_in_projectbuilds(self):
864 """ Task should be shown as suffix on build name """
865 build = Build.objects.create(**self.project1_build_success)
866 Target.objects.create(build=build, target='bash', task='clean')
867
868 url = reverse('projectbuilds', args=(self.project1.id,))
869 response = self.client.get(url, {'format': 'json'}, follow=True)
870 data = json.loads(response.content)
871 cell = data['rows'][0]['static:target']
872
873 result = re.findall('^ +bash:clean', cell, re.MULTILINE)
874 self.assertEqual(len(result), 1)
875
876 def test_cli_builds_hides_tabs(self):
877 """
878 Display for command line builds should hide tabs;
879 note that the latest builds section is already tested in
880 AllBuildsPageTests, as the template is the same
881 """
882 url = reverse("projectbuilds", args=(self.default_project.id,))
883 response = self.client.get(url, follow=True)
884 soup = BeautifulSoup(response.content)
885 tabs = soup.select('#project-topbar')
886 self.assertEqual(len(tabs), 0,
887 'should be no top bar shown for command line builds')
888
889 def test_non_cli_builds_has_tabs(self):
890 """
891 Non-command-line builds projects should show the tabs
892 """
893 url = reverse("projectbuilds", args=(self.project1.id,))
894 response = self.client.get(url, follow=True)
895 soup = BeautifulSoup(response.content)
896 tabs = soup.select('#project-topbar')
897 self.assertEqual(len(tabs), 1,
898 'should be a top bar shown for non-command-line builds')
899
900class BuildDashboardTests(TestCase): 767class BuildDashboardTests(TestCase):
901 """ Tests for the build dashboard /build/X """ 768 """ Tests for the build dashboard /build/X """
902 769