summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2016-05-10 00:01:52 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-11 11:32:58 +0100
commit28433319ad8299aa23b1fcfdddbe100b29e86517 (patch)
treed79a2e91aea2b77763c95b11777d4217bdc3d70b /bitbake
parentcd4f0b3a8307547aaa536c111ea98012605aae86 (diff)
downloadpoky-28433319ad8299aa23b1fcfdddbe100b29e86517.tar.gz
bitbake: toaster: tests browser Add test for creating a project
Add browser tests for creating a project and test validation of duplicate project names. (Bitbake rev: 8055fbe840db426d6859ee2248f86abd44244b30) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/tests/browser/test_new_project_page.py109
1 files changed, 109 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/tests/browser/test_new_project_page.py b/bitbake/lib/toaster/tests/browser/test_new_project_page.py
new file mode 100644
index 0000000000..1b038acb96
--- /dev/null
+++ b/bitbake/lib/toaster/tests/browser/test_new_project_page.py
@@ -0,0 +1,109 @@
1#! /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 tests.browser.selenium_helpers import SeleniumTestCase
24from selenium.webdriver.support.ui import Select
25
26from orm.models import Project, Release, BitbakeVersion
27
28
29class TestNewProjectPage(SeleniumTestCase):
30 """ Test project data at /project/X/ is displayed correctly """
31
32 def setUp(self):
33 bitbake, c = BitbakeVersion.objects.get_or_create(
34 name="master",
35 giturl="git://master",
36 branch="master",
37 dirpath="master")
38
39 release, c = Release.objects.get_or_create(name="msater",
40 description="master"
41 "release",
42 branch_name="master",
43 helptext="latest",
44 bitbake_version=bitbake)
45
46 self.release, c = Release.objects.get_or_create(
47 name="msater2",
48 description="master2"
49 "release2",
50 branch_name="master2",
51 helptext="latest2",
52 bitbake_version=bitbake)
53
54 def test_create_new_project(self):
55 """ Test creating a project """
56
57 project_name = "masterproject"
58
59 url = reverse('newproject')
60 self.get(url)
61
62 self.enter_text('#new-project-name', project_name)
63
64 select = Select(self.find('#projectversion'))
65 select.select_by_value(str(self.release.pk))
66
67 self.click("#create-project-button")
68
69 # We should get redirected to the new project's page with the
70 # notification at the top
71 element = self.wait_until_visible('#project-created-notification')
72
73 self.assertTrue(project_name in element.text,
74 "New project name not in new project notification")
75
76 self.assertTrue(Project.objects.filter(name=project_name).count(),
77 "New project not found in database")
78
79 def test_new_duplicates_project_name(self):
80 """
81 Should not be able to create a new project whose name is the same
82 as an existing project
83 """
84
85 project_name = "dupproject"
86
87 Project.objects.create_project(name=project_name,
88 release=self.release)
89
90 url = reverse('newproject')
91 self.get(url)
92
93 self.enter_text('#new-project-name', project_name)
94
95 select = Select(self.find('#projectversion'))
96 select.select_by_value(str(self.release.pk))
97
98 element = self.wait_until_visible('#hint-error-project-name')
99
100 self.assertTrue(("Project names must be unique" in element.text),
101 "Did not find unique project name error message")
102
103 # Try and click it anyway, if it submits we'll have a new project in
104 # the db and assert then
105 self.click("#create-project-button")
106
107 self.assertTrue(
108 (Project.objects.filter(name=project_name).count() == 1),
109 "New project not found in database")