diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/tests.py')
-rw-r--r-- | bitbake/lib/toaster/toastergui/tests.py | 133 |
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): self.assertEqual(soup.find('a')['href'], expected_url, 'link on project name should point to configuration') -class ProjectBuildsPageTests(TestCase): - """ Test data at /project/X/builds is displayed correctly """ - - def setUp(self): - bbv = BitbakeVersion.objects.create(name="bbv1", giturl="/tmp/", - branch="master", dirpath="") - release = Release.objects.create(name="release1", - bitbake_version=bbv) - self.project1 = Project.objects.create_project(name=PROJECT_NAME, - release=release) - self.project1.save() - - self.project2 = Project.objects.create_project(name=PROJECT_NAME, - release=release) - self.project2.save() - - self.default_project = Project.objects.create_project( - name=CLI_BUILDS_PROJECT_NAME, - release=release - ) - self.default_project.is_default = True - self.default_project.save() - - # parameters for builds to associate with the projects - now = timezone.now() - - self.project1_build_success = { - "project": self.project1, - "started_on": now, - "completed_on": now, - "outcome": Build.SUCCEEDED - } - - self.project1_build_in_progress = { - "project": self.project1, - "started_on": now, - "completed_on": now, - "outcome": Build.IN_PROGRESS - } - - self.project2_build_success = { - "project": self.project2, - "started_on": now, - "completed_on": now, - "outcome": Build.SUCCEEDED - } - - self.project2_build_in_progress = { - "project": self.project2, - "started_on": now, - "completed_on": now, - "outcome": Build.IN_PROGRESS - } - - def _get_rows_for_project(self, project_id): - """ Helper to retrieve HTML rows for a project """ - url = reverse("projectbuilds", args=(project_id,)) - response = self.client.get(url, {'format': 'json'}, follow=True) - data = json.loads(response.content) - return data['rows'] - - def test_show_builds_for_project(self): - """ Builds for a project should be displayed """ - Build.objects.create(**self.project1_build_success) - Build.objects.create(**self.project1_build_success) - build_rows = self._get_rows_for_project(self.project1.id) - self.assertEqual(len(build_rows), 2) - - def test_show_builds_project_only(self): - """ Builds for other projects should be excluded """ - Build.objects.create(**self.project1_build_success) - Build.objects.create(**self.project1_build_success) - Build.objects.create(**self.project1_build_success) - - # shouldn't see these two - Build.objects.create(**self.project2_build_success) - Build.objects.create(**self.project2_build_in_progress) - - build_rows = self._get_rows_for_project(self.project1.id) - self.assertEqual(len(build_rows), 3) - - def test_builds_exclude_in_progress(self): - """ "in progress" builds should not be shown """ - Build.objects.create(**self.project1_build_success) - Build.objects.create(**self.project1_build_success) - - # shouldn't see this one - Build.objects.create(**self.project1_build_in_progress) - - # shouldn't see these two either, as they belong to a different project - Build.objects.create(**self.project2_build_success) - Build.objects.create(**self.project2_build_in_progress) - - build_rows = self._get_rows_for_project(self.project1.id) - self.assertEqual(len(build_rows), 2) - - def test_tasks_in_projectbuilds(self): - """ Task should be shown as suffix on build name """ - build = Build.objects.create(**self.project1_build_success) - Target.objects.create(build=build, target='bash', task='clean') - - url = reverse('projectbuilds', args=(self.project1.id,)) - response = self.client.get(url, {'format': 'json'}, follow=True) - data = json.loads(response.content) - cell = data['rows'][0]['static:target'] - - result = re.findall('^ +bash:clean', cell, re.MULTILINE) - self.assertEqual(len(result), 1) - - def test_cli_builds_hides_tabs(self): - """ - Display for command line builds should hide tabs; - note that the latest builds section is already tested in - AllBuildsPageTests, as the template is the same - """ - url = reverse("projectbuilds", args=(self.default_project.id,)) - response = self.client.get(url, follow=True) - soup = BeautifulSoup(response.content) - tabs = soup.select('#project-topbar') - self.assertEqual(len(tabs), 0, - 'should be no top bar shown for command line builds') - - def test_non_cli_builds_has_tabs(self): - """ - Non-command-line builds projects should show the tabs - """ - url = reverse("projectbuilds", args=(self.project1.id,)) - response = self.client.get(url, follow=True) - soup = BeautifulSoup(response.content) - tabs = soup.select('#project-topbar') - self.assertEqual(len(tabs), 1, - 'should be a top bar shown for non-command-line builds') - class BuildDashboardTests(TestCase): """ Tests for the build dashboard /build/X """ |