From: Michael Wood <michael.g.wood@intel.com>
To: "Smith, Elliot" <elliot.smith@intel.com>
Cc: toaster@yoctoproject.org
Subject: Re: [PATCH 5/5] toaster: tests browser Add test for creating a project
Date: Tue, 10 May 2016 13:10:17 +0100 [thread overview]
Message-ID: <5731CFA9.5010500@intel.com> (raw)
In-Reply-To: <CA+1hgUjx_bwn5V7imywEj1cbJR7R6b825AeAg=EzpDJdQ-AQ1w@mail.gmail.com>
Upstreamed and pushed to toaster-next with the typo corrected
On 09/05/16 17:22, Smith, Elliot wrote:
> Looks good, but one typo (see below).
>
> I'm happy for you to upstream it.
>
> Elliot
>
> On 9 May 2016 at 16:27, Michael Wood <michael.g.wood@intel.com
> <mailto:michael.g.wood@intel.com>> wrote:
>
> Add browser tests for creating a project and test validation of
> duplicate project names.
>
> Signed-off-by: Michael Wood <michael.g.wood@intel.com
> <mailto:michael.g.wood@intel.com>>
> ---
> .../toaster/tests/browser/test_new_project_page.py | 109
> +++++++++++++++++++++
> 1 file changed, 109 insertions(+)
> create mode 100644
> bitbake/lib/toaster/tests/browser/test_new_project_page.py
>
> 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 0000000..b9358ab
> --- /dev/null
> +++ b/bitbake/lib/toaster/tests/browser/test_new_project_page.py
> @@ -0,0 +1,109 @@
> +#! /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 tests.browser.selenium_helpers import SeleniumTestCase
> +from selenium.webdriver.support.ui import Select
> +
> +from orm.models import Project, Release, BitbakeVersion
> +
> +
> +class TestNewProjectPage(SeleniumTestCase):
> + """ Test project data at /project/X/ is displayed correctly """
> +
> + def setUp(self):
> + bitbake, c = BitbakeVersion.objects.get_or_create(
> + name="master",
> + giturl="git://master",
> + branch="master",
> + dirpath="master")
> +
> + release, c = Release.objects.get_or_create(name="msater",
> + description="master"
> + "release",
> + branch_name="master",
> + helptext="latest",
> + bitbake_version=bitbake)
> +
> + self.release, c = Release.objects.get_or_create(
> + name="msater2",
> + description="master2"
> + "release2",
> + branch_name="master2",
> + helptext="latest2",
> + bitbake_version=bitbake)
> +
> + def test_create_new_project(self):
> + """ Test creating a project """
> +
> + project_name = "masterproject"
> +
> + url = reverse('newproject')
> + self.get(url)
> +
> + self.enter_text('#new-project-name', project_name)
> +
> + select = Select(self.find('#projectversion'))
> + select.select_by_value(str(self.release.pk
> <http://self.release.pk>))
> +
> + self.click("#create-project-button")
> +
> + # We should get redirected to the new project's page with the
> + # notification at the top
> + element =
> self.wait_until_visible('#project-created-notification')
> +
> + self.assertTrue(project_name in element.text,
> + "New project name not in new project
> notification")
> +
> + self.assertTrue(Project.objects.filter(name=project_name).count(),
> + "New project not found in database")
> +
> + def test_new_duplicates_project_name(self):
> + """
> + Should not be able to create a new project whose name is
> the same
> + as an existing project
> + """
> +
> + project_name = "dupproject"
> +
> + Project.objects.create_project(name=project_name,
> + release=self.release)
> +
> + url = reverse('newproject')
> + self.get(url)
> +
> + self.enter_text('#new-project-name', project_name)
> +
> + select = Select(self.find('#projectversion'))
> + select.select_by_value(str(self.release.pk
> <http://self.release.pk>))
> +
> + element = self.wait_until_visible('#hint-error-project-name')
> +
> + self.assertTrue(("Project names must be unique" in
> element.text),
> + "Did not find unqiue project name error
> message")
>
>
> TYPO: unqiue -> unique
>
> +
> + # Try and click it anyway, if it submits we'll have a new
> project in
> + # the db and assert then
> + self.click("#create-project-button")
> +
> + self.assertTrue(
> + (Project.objects.filter(name=project_name).count() == 1),
> + "New project not found in database")
> --
> 2.7.4
>
> --
> _______________________________________________
> toaster mailing list
> toaster@yoctoproject.org <mailto:toaster@yoctoproject.org>
> https://lists.yoctoproject.org/listinfo/toaster
>
>
>
>
> --
> Elliot Smith
> Software Engineer
> Intel Open Source Technology Centre
>
> ---------------------------------------------------------------------
> Intel Corporation (UK) Limited
> Registered No. 1134945 (England)
> Registered Office: Pipers Way, Swindon SN3 1RJ
> VAT No: 860 2173 47
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
>
next prev parent reply other threads:[~2016-05-10 12:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-09 15:27 [PATCH 0/5] Unique project names Michael Wood
2016-05-09 15:27 ` [PATCH 1/5] toaster: projectNameValidation API added Michael Wood
2016-05-09 15:27 ` [PATCH 2/5] toaster: ui handles duplicate project name in new project page Michael Wood
2016-05-09 15:27 ` [PATCH 3/5] toaster: ui handles duplicate project name in " Michael Wood
2016-05-09 15:27 ` [PATCH 4/5] toaster: models Add missing import sys Michael Wood
2016-05-09 15:27 ` [PATCH 5/5] toaster: tests browser Add test for creating a project Michael Wood
2016-05-09 16:22 ` Smith, Elliot
2016-05-10 12:10 ` Michael Wood [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-05-09 23:01 [PATCH 0/5] Validate unique project names Michael Wood
2016-05-09 23:01 ` [PATCH 5/5] toaster: tests browser Add test for creating a project Michael Wood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5731CFA9.5010500@intel.com \
--to=michael.g.wood@intel.com \
--cc=elliot.smith@intel.com \
--cc=toaster@yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.