diff options
Diffstat (limited to 'bitbake/lib/toaster/tests/browser/test_new_custom_image_page.py')
-rw-r--r-- | bitbake/lib/toaster/tests/browser/test_new_custom_image_page.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/bitbake/lib/toaster/tests/browser/test_new_custom_image_page.py b/bitbake/lib/toaster/tests/browser/test_new_custom_image_page.py index 9906ae42a9..9f0b6397fe 100644 --- a/bitbake/lib/toaster/tests/browser/test_new_custom_image_page.py +++ b/bitbake/lib/toaster/tests/browser/test_new_custom_image_page.py | |||
@@ -6,6 +6,7 @@ | |||
6 | # | 6 | # |
7 | # SPDX-License-Identifier: GPL-2.0-only | 7 | # SPDX-License-Identifier: GPL-2.0-only |
8 | # | 8 | # |
9 | from bldcontrol.models import BuildEnvironment | ||
9 | 10 | ||
10 | from django.urls import reverse | 11 | from django.urls import reverse |
11 | from tests.browser.selenium_helpers import SeleniumTestCase | 12 | from tests.browser.selenium_helpers import SeleniumTestCase |
@@ -18,6 +19,9 @@ class TestNewCustomImagePage(SeleniumTestCase): | |||
18 | CUSTOM_IMAGE_NAME = 'roopa-doopa' | 19 | CUSTOM_IMAGE_NAME = 'roopa-doopa' |
19 | 20 | ||
20 | def setUp(self): | 21 | def setUp(self): |
22 | BuildEnvironment.objects.get_or_create( | ||
23 | betype=BuildEnvironment.TYPE_LOCAL, | ||
24 | ) | ||
21 | release = Release.objects.create( | 25 | release = Release.objects.create( |
22 | name='baz', | 26 | name='baz', |
23 | bitbake_version=BitbakeVersion.objects.create(name='v1') | 27 | bitbake_version=BitbakeVersion.objects.create(name='v1') |
@@ -41,11 +45,16 @@ class TestNewCustomImagePage(SeleniumTestCase): | |||
41 | ) | 45 | ) |
42 | 46 | ||
43 | # add a fake image recipe to the layer that can be customised | 47 | # add a fake image recipe to the layer that can be customised |
48 | builldir = os.environ.get('BUILDDIR', './') | ||
44 | self.recipe = Recipe.objects.create( | 49 | self.recipe = Recipe.objects.create( |
45 | name='core-image-minimal', | 50 | name='core-image-minimal', |
46 | layer_version=layer_version, | 51 | layer_version=layer_version, |
52 | file_path=f'{builldir}/core-image-minimal.bb', | ||
47 | is_image=True | 53 | is_image=True |
48 | ) | 54 | ) |
55 | # create a tmp file for the recipe | ||
56 | with open(self.recipe.file_path, 'w') as f: | ||
57 | f.write('foo') | ||
49 | 58 | ||
50 | # another project with a custom image already in it | 59 | # another project with a custom image already in it |
51 | project2 = Project.objects.create(name='whoop', release=release) | 60 | project2 = Project.objects.create(name='whoop', release=release) |
@@ -81,6 +90,7 @@ class TestNewCustomImagePage(SeleniumTestCase): | |||
81 | """ | 90 | """ |
82 | url = reverse('newcustomimage', args=(self.project.id,)) | 91 | url = reverse('newcustomimage', args=(self.project.id,)) |
83 | self.get(url) | 92 | self.get(url) |
93 | self.wait_until_visible('#global-nav', poll=3) | ||
84 | 94 | ||
85 | self.click('button[data-recipe="%s"]' % self.recipe.id) | 95 | self.click('button[data-recipe="%s"]' % self.recipe.id) |
86 | 96 | ||
@@ -128,7 +138,7 @@ class TestNewCustomImagePage(SeleniumTestCase): | |||
128 | """ | 138 | """ |
129 | self._create_custom_image(self.recipe.name) | 139 | self._create_custom_image(self.recipe.name) |
130 | element = self.wait_until_visible('#invalid-name-help') | 140 | element = self.wait_until_visible('#invalid-name-help') |
131 | self.assertRegexpMatches(element.text.strip(), | 141 | self.assertRegex(element.text.strip(), |
132 | 'image with this name already exists') | 142 | 'image with this name already exists') |
133 | 143 | ||
134 | def test_new_duplicates_project_image(self): | 144 | def test_new_duplicates_project_image(self): |
@@ -146,4 +156,4 @@ class TestNewCustomImagePage(SeleniumTestCase): | |||
146 | self._create_custom_image(custom_image_name) | 156 | self._create_custom_image(custom_image_name) |
147 | element = self.wait_until_visible('#invalid-name-help') | 157 | element = self.wait_until_visible('#invalid-name-help') |
148 | expected = 'An image with this name already exists in this project' | 158 | expected = 'An image with this name already exists in this project' |
149 | self.assertRegexpMatches(element.text.strip(), expected) | 159 | self.assertRegex(element.text.strip(), expected) |