blob: 786bef1c6ea3fbf31924a0d1ae3f008cd0f30281 [file] [log] [blame]
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001#! /usr/bin/env python
2# ex:ts=4:sw=4:sts=4:et
3# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
4#
5# BitBake Toaster Implementation
6#
7# Copyright (C) 2013-2016 Intel Corporation
8#
9# This program is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License version 2 as
11# published by the Free Software Foundation.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License along
19# with this program; if not, write to the Free Software Foundation, Inc.,
20# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
22from django.core.urlresolvers import reverse
23from django.utils import timezone
24from tests.browser.selenium_helpers import SeleniumTestCase
25
26from orm.models import Build, Project
27
28class TestProjectPage(SeleniumTestCase):
29 """ Test project data at /project/X/ is displayed correctly """
30
31 CLI_BUILDS_PROJECT_NAME = 'Command line builds'
32
33 def test_cli_builds_in_progress(self):
34 """
35 In progress builds should not cause an error to be thrown
36 when navigating to "command line builds" project page;
37 see https://bugzilla.yoctoproject.org/show_bug.cgi?id=8277
38 """
39
40 # add the "command line builds" default project; this mirrors what
41 # we do with get_or_create_default_project()
42 default_project = Project.objects.create_project(self.CLI_BUILDS_PROJECT_NAME, None)
43 default_project.is_default = True
44 default_project.save()
45
46 # add an "in progress" build for the default project
47 now = timezone.now()
48 Build.objects.create(project=default_project,
49 started_on=now,
50 completed_on=now,
51 outcome=Build.IN_PROGRESS)
52
53 # navigate to the project page for the default project
54 url = reverse("project", args=(default_project.id,))
55 self.get(url)
56
57 # check that we get a project page with the correct heading
58 project_name = self.find('#project-name').text.strip()
59 self.assertEqual(project_name, self.CLI_BUILDS_PROJECT_NAME)