From 76702347a8f51871106e32f81e459c5548482e3d Mon Sep 17 00:00:00 2001 From: Elliot Smith Date: Fri, 2 Oct 2015 14:23:35 +0100 Subject: bitbake: toaster: Hide tabs and add info popups for command line builds Command line builds don't have a configuration or layers which can be modified through Toaster. Change the project builds page for the command line builds project, to hide the tabs and add some info popups in appropriate places on that page. [YOCTO #8231] (Bitbake rev: 565611749d47c915035890db60d19ab2fca7c42e) Signed-off-by: Elliot Smith Signed-off-by: Ed Bartosh Signed-off-by: brian avery Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastergui/tests.py | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'bitbake/lib/toaster/toastergui/tests.py') 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): 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() @@ -630,6 +640,13 @@ class ProjectBuildsPageTests(TestCase): "outcome": Build.IN_PROGRESS } + self.default_project_build_success = { + "project": self.default_project, + "started_on": now, + "completed_on": now, + "outcome": Build.SUCCEEDED + } + def _get_rows_for_project(self, project_id): """ Helper to retrieve HTML rows for a project """ url = reverse("projectbuilds", args=(project_id,)) @@ -681,6 +698,30 @@ class ProjectBuildsPageTests(TestCase): result = re.findall('^ +bash:clean$', response.content, re.MULTILINE) self.assertEqual(len(result), 2) + 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 AllBuildsPageTests(TestCase): """ Tests for all builds page /builds/ """ -- cgit v1.2.3-54-g00ecf