diff options
Diffstat (limited to 'lib/toaster/tests/browser/test_new_custom_image_page.py')
-rw-r--r-- | lib/toaster/tests/browser/test_new_custom_image_page.py | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/lib/toaster/tests/browser/test_new_custom_image_page.py b/lib/toaster/tests/browser/test_new_custom_image_page.py index ab5a8e66b..9f0b6397f 100644 --- a/lib/toaster/tests/browser/test_new_custom_image_page.py +++ b/lib/toaster/tests/browser/test_new_custom_image_page.py @@ -1,25 +1,14 @@ -#! /usr/bin/env python -# ex:ts=4:sw=4:sts=4:et -# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +#! /usr/bin/env python3 # # 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. +# SPDX-License-Identifier: GPL-2.0-only # -# 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 bldcontrol.models import BuildEnvironment -from django.core.urlresolvers import reverse +from django.urls import reverse from tests.browser.selenium_helpers import SeleniumTestCase from orm.models import BitbakeVersion, Release, Project, ProjectLayer, Layer @@ -30,6 +19,9 @@ class TestNewCustomImagePage(SeleniumTestCase): CUSTOM_IMAGE_NAME = 'roopa-doopa' def setUp(self): + BuildEnvironment.objects.get_or_create( + betype=BuildEnvironment.TYPE_LOCAL, + ) release = Release.objects.create( name='baz', bitbake_version=BitbakeVersion.objects.create(name='v1') @@ -53,11 +45,16 @@ class TestNewCustomImagePage(SeleniumTestCase): ) # add a fake image recipe to the layer that can be customised + builldir = os.environ.get('BUILDDIR', './') self.recipe = Recipe.objects.create( name='core-image-minimal', layer_version=layer_version, + file_path=f'{builldir}/core-image-minimal.bb', is_image=True ) + # create a tmp file for the recipe + with open(self.recipe.file_path, 'w') as f: + f.write('foo') # another project with a custom image already in it project2 = Project.objects.create(name='whoop', release=release) @@ -93,6 +90,7 @@ class TestNewCustomImagePage(SeleniumTestCase): """ url = reverse('newcustomimage', args=(self.project.id,)) self.get(url) + self.wait_until_visible('#global-nav', poll=3) self.click('button[data-recipe="%s"]' % self.recipe.id) @@ -140,7 +138,7 @@ class TestNewCustomImagePage(SeleniumTestCase): """ self._create_custom_image(self.recipe.name) element = self.wait_until_visible('#invalid-name-help') - self.assertRegexpMatches(element.text.strip(), + self.assertRegex(element.text.strip(), 'image with this name already exists') def test_new_duplicates_project_image(self): @@ -158,4 +156,4 @@ class TestNewCustomImagePage(SeleniumTestCase): self._create_custom_image(custom_image_name) element = self.wait_until_visible('#invalid-name-help') expected = 'An image with this name already exists in this project' - self.assertRegexpMatches(element.text.strip(), expected) + self.assertRegex(element.text.strip(), expected) |