diff options
author | Dave Cobbley <david.j.cobbley@linux.intel.com> | 2018-08-14 20:05:37 +0300 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-08-23 04:26:31 +0300 |
commit | eb8dc40360f0cfef56fb6947cc817a547d6d9bc6 (patch) | |
tree | de291a73dc37168da6370e2cf16c347d1eba9df8 /poky/bitbake/lib/toaster/tests/browser/test_landing_page.py | |
parent | 9c3cf826d853102535ead04cebc2d6023eff3032 (diff) | |
download | openbmc-eb8dc40360f0cfef56fb6947cc817a547d6d9bc6.tar.xz |
[Subtree] Removing import-layers directory
As part of the move to subtrees, need to bring all the import layers
content to the top level.
Change-Id: I4a163d10898cbc6e11c27f776f60e1a470049d8f
Signed-off-by: Dave Cobbley <david.j.cobbley@linux.intel.com>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'poky/bitbake/lib/toaster/tests/browser/test_landing_page.py')
-rw-r--r-- | poky/bitbake/lib/toaster/tests/browser/test_landing_page.py | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/poky/bitbake/lib/toaster/tests/browser/test_landing_page.py b/poky/bitbake/lib/toaster/tests/browser/test_landing_page.py new file mode 100644 index 000000000..4d4cd660f --- /dev/null +++ b/poky/bitbake/lib/toaster/tests/browser/test_landing_page.py @@ -0,0 +1,108 @@ +#! /usr/bin/env python +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# BitBake Toaster Implementation +# +# Copyright (C) 2013-2016 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +from django.core.urlresolvers import reverse +from django.utils import timezone +from tests.browser.selenium_helpers import SeleniumTestCase + +from orm.models import Project, Build + +class TestLandingPage(SeleniumTestCase): + """ Tests for redirects on the landing page """ + + PROJECT_NAME = 'test project' + LANDING_PAGE_TITLE = 'This is Toaster' + CLI_BUILDS_PROJECT_NAME = 'command line builds' + + def setUp(self): + """ Add default project manually """ + self.project = Project.objects.create_project( + self.CLI_BUILDS_PROJECT_NAME, + None + ) + self.project.is_default = True + self.project.save() + + def test_only_default_project(self): + """ + No projects except default + => should see the landing page + """ + self.get(reverse('landing')) + self.assertTrue(self.LANDING_PAGE_TITLE in self.get_page_source()) + + def test_default_project_has_build(self): + """ + Default project has a build, no other projects + => should see the builds page + """ + now = timezone.now() + build = Build.objects.create(project=self.project, + started_on=now, + completed_on=now) + build.save() + + self.get(reverse('landing')) + + elements = self.find_all('#allbuildstable') + self.assertEqual(len(elements), 1, 'should redirect to builds') + content = self.get_page_source() + self.assertFalse(self.PROJECT_NAME in content, + 'should not show builds for project %s' % self.PROJECT_NAME) + self.assertTrue(self.CLI_BUILDS_PROJECT_NAME in content, + 'should show builds for cli project') + + def test_user_project_exists(self): + """ + User has added a project (without builds) + => should see the projects page + """ + user_project = Project.objects.create_project('foo', None) + user_project.save() + + self.get(reverse('landing')) + + elements = self.find_all('#projectstable') + self.assertEqual(len(elements), 1, 'should redirect to projects') + + def test_user_project_has_build(self): + """ + User has added a project (with builds), command line builds doesn't + => should see the builds page + """ + user_project = Project.objects.create_project(self.PROJECT_NAME, None) + user_project.save() + + now = timezone.now() + build = Build.objects.create(project=user_project, + started_on=now, + completed_on=now) + build.save() + + self.get(reverse('landing')) + + elements = self.find_all('#allbuildstable') + self.assertEqual(len(elements), 1, 'should redirect to builds') + content = self.get_page_source() + self.assertTrue(self.PROJECT_NAME in content, + 'should show builds for project %s' % self.PROJECT_NAME) + self.assertFalse(self.CLI_BUILDS_PROJECT_NAME in content, + 'should not show builds for cli project') |