Fix gate jobs

After change Icca91c53eabf18c3109b3931ed53f70eaaaa0e56
method "image_list_detailed" returns list of "Image"
instances which inherit from
openstack_dashboard.api.base.APIResourceWrapper.
For getting "image_type" attribute we need to use "get"
method now.

Closes-bug: #1624318
Change-Id: I363ddc1bc46a1daa855d1d41920bf8a4a4df2396
This commit is contained in:
Vitaly Gridnev 2016-09-19 13:23:38 +03:00
parent b05932f4fb
commit 6deb3c5fcb
6 changed files with 13 additions and 8 deletions

View File

@ -66,7 +66,8 @@ class RegisterImageForm(ImageForm):
images = self._get_available_images(self.request)
choices = [(image.id, image.name)
for image in images
if image.properties.get("image_type", '') != "snapshot"]
if image.to_dict()['properties'].get(
"image_type") != "snapshot"]
if choices:
choices.insert(0, ("", _("Select Image")))
else:

View File

@ -24,8 +24,8 @@ class SaharaTestCase(helpers.AdminTestCase):
sahara_group = cfg.OptGroup(
'sahara', help='Sahara specific tests config group')
cls.CONFIG.register_group(sahara_group)
fake_http_image = cfg.StrOpt('fake_http_image')
cls.CONFIG.register_opt(fake_http_image, group=sahara_group)
fake_image_location = cfg.StrOpt('fake_image_location')
cls.CONFIG.register_opt(fake_image_location, group=sahara_group)
ssh_user = cfg.StrOpt('fake_image_ssh_user')
cls.CONFIG.register_opt(ssh_user, group=sahara_group)
project_name = cfg.StrOpt('project_name', default='demo')

View File

@ -38,7 +38,7 @@ http_image=https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg
[sahara]
# http accessible image (string value)
fake_http_image=https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img
fake_image_location=/tmp/xenial-server-cloudimg-amd64-disk1.img
# ssh username for image (string value)
fake_image_ssh_user=ubuntu
# Floating IP pool name (string value)

View File

@ -53,8 +53,8 @@ class TestCRUDBase(SaharaTestCase):
def create_image(self):
image_pg = self.home_pg.go_to_compute_imagespage()
image_pg.create_image(self.image_name,
location=self.CONFIG.sahara.fake_http_image)
image_pg.create_image(
self.image_name, image_file=self.CONFIG.sahara.fake_image_location)
image_pg._wait_until(
lambda x: image_pg.is_image_active(self.image_name),
timeout=10 * 60)

View File

@ -13,16 +13,18 @@
from openstack_dashboard.test.integration_tests import helpers
from openstack_dashboard.test.integration_tests.regions import messages
from sahara_dashboard.test.integration_tests.helpers import SaharaTestCase
IMAGE_NAME = helpers.gen_random_resource_name("image")
class TestSaharaImageRegistry(helpers.TestCase):
class TestSaharaImageRegistry(SaharaTestCase):
def setUp(self):
super(TestSaharaImageRegistry, self).setUp()
image_pg = self.home_pg.go_to_compute_imagespage()
image_pg.create_image(IMAGE_NAME)
image_pg.create_image(
IMAGE_NAME, image_file=self.CONFIG.sahara.fake_image_location)
image_pg.find_message_and_dismiss(messages.SUCCESS)
image_pg.wait_until_image_active(IMAGE_NAME)

View File

@ -5,6 +5,8 @@
set -ex
source commons $@
wget https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img -O /tmp/xenial-server-cloudimg-amd64-disk1.img
cd /opt/stack/new/horizon/openstack_dashboard/local/local_settings.d
mv _20_integration_tests_scaffolds.py.example _20_integration_tests_scaffolds.py