Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame^] | 1 | #! /usr/bin/env python3 |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 2 | # |
| 3 | # BitBake Toaster Implementation |
| 4 | # |
| 5 | # Copyright (C) 2013-2016 Intel Corporation |
| 6 | # |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 7 | # SPDX-License-Identifier: GPL-2.0-only |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 8 | # |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 9 | |
| 10 | from django.core.urlresolvers import reverse |
| 11 | from django.utils import timezone |
| 12 | from tests.browser.selenium_helpers import SeleniumTestCase |
| 13 | |
| 14 | from orm.models import Build, Project |
| 15 | |
| 16 | class TestProjectPage(SeleniumTestCase): |
| 17 | """ Test project data at /project/X/ is displayed correctly """ |
| 18 | |
| 19 | CLI_BUILDS_PROJECT_NAME = 'Command line builds' |
| 20 | |
| 21 | def test_cli_builds_in_progress(self): |
| 22 | """ |
| 23 | In progress builds should not cause an error to be thrown |
| 24 | when navigating to "command line builds" project page; |
| 25 | see https://bugzilla.yoctoproject.org/show_bug.cgi?id=8277 |
| 26 | """ |
| 27 | |
| 28 | # add the "command line builds" default project; this mirrors what |
| 29 | # we do with get_or_create_default_project() |
| 30 | default_project = Project.objects.create_project(self.CLI_BUILDS_PROJECT_NAME, None) |
| 31 | default_project.is_default = True |
| 32 | default_project.save() |
| 33 | |
| 34 | # add an "in progress" build for the default project |
| 35 | now = timezone.now() |
| 36 | Build.objects.create(project=default_project, |
| 37 | started_on=now, |
| 38 | completed_on=now, |
| 39 | outcome=Build.IN_PROGRESS) |
| 40 | |
| 41 | # navigate to the project page for the default project |
| 42 | url = reverse("project", args=(default_project.id,)) |
| 43 | self.get(url) |
| 44 | |
| 45 | # check that we get a project page with the correct heading |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 46 | project_name = self.find('.project-name').text.strip() |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 47 | self.assertEqual(project_name, self.CLI_BUILDS_PROJECT_NAME) |