mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 13:29:49 +00:00
bitbake: toaster: tests Migrate landing page tests to Selenium
(Bitbake rev: 20ce1e1b39a9b602eb51ca0ba3954ea3e999c874) Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
5b848fa727
commit
7dcb4c4127
@@ -493,80 +493,6 @@ class ViewTests(TestCase):
|
||||
"Changed page on table %s but first row is the "
|
||||
"same as the previous page" % name)
|
||||
|
||||
class LandingPageTests(TestCase):
|
||||
""" Tests for redirects on the landing page """
|
||||
# disable bogus pylint message error:
|
||||
# "Instance of 'WSGIRequest' has no 'url' member (no-member)"
|
||||
# (see https://github.com/landscapeio/pylint-django/issues/42)
|
||||
# pylint: disable=E1103
|
||||
|
||||
LANDING_PAGE_TITLE = 'This is Toaster'
|
||||
|
||||
def setUp(self):
|
||||
""" Add default project manually """
|
||||
self.project = Project.objects.create_project('foo', None)
|
||||
self.project.is_default = True
|
||||
self.project.save()
|
||||
|
||||
def test_only_default_project(self):
|
||||
"""
|
||||
No projects except default
|
||||
=> get the landing page
|
||||
"""
|
||||
response = self.client.get(reverse('landing'))
|
||||
self.assertTrue(self.LANDING_PAGE_TITLE in response.content)
|
||||
|
||||
def test_default_project_has_build(self):
|
||||
"""
|
||||
Default project has a build, no other projects
|
||||
=> get the builds page
|
||||
"""
|
||||
now = timezone.now()
|
||||
build = Build.objects.create(project=self.project,
|
||||
started_on=now,
|
||||
completed_on=now)
|
||||
build.save()
|
||||
|
||||
response = self.client.get(reverse('landing'))
|
||||
self.assertEqual(response.status_code, 302,
|
||||
'response should be a redirect')
|
||||
self.assertTrue('/builds' in response.url,
|
||||
'should redirect to builds')
|
||||
|
||||
def test_user_project_exists(self):
|
||||
"""
|
||||
User has added a project (without builds)
|
||||
=> get the projects page
|
||||
"""
|
||||
user_project = Project.objects.create_project('foo', None)
|
||||
user_project.save()
|
||||
|
||||
response = self.client.get(reverse('landing'))
|
||||
self.assertEqual(response.status_code, 302,
|
||||
'response should be a redirect')
|
||||
self.assertTrue('/projects' in response.url,
|
||||
'should redirect to projects')
|
||||
|
||||
def test_user_project_has_build(self):
|
||||
"""
|
||||
User has added a project (with builds)
|
||||
=> get the builds page
|
||||
"""
|
||||
user_project = Project.objects.create_project('foo', None)
|
||||
user_project.save()
|
||||
|
||||
now = timezone.now()
|
||||
build = Build.objects.create(project=user_project,
|
||||
started_on=now,
|
||||
completed_on=now)
|
||||
build.save()
|
||||
|
||||
response = self.client.get(reverse('landing'))
|
||||
self.assertEqual(response.status_code, 302,
|
||||
'response should be a redirect')
|
||||
self.assertTrue('/builds' in response.url,
|
||||
'should redirect to builds')
|
||||
|
||||
class BuildDashboardTests(TestCase):
|
||||
""" Tests for the build dashboard /build/X """
|
||||
|
||||
|
||||
Reference in New Issue
Block a user