From 6c32e15b03bae2a6a20c80a11e122ad76df04da5 Mon Sep 17 00:00:00 2001 From: liusheng Date: Wed, 7 Jun 2017 11:18:56 +0800 Subject: [PATCH] Fix the test_flavor_show tempest test The test_flavor_show test has a wrong assertion to test the "is_public" field of output of flavor show. Closes-Bug: #1696293 Change-Id: I779943b5a5ea19b2f4e9b6843048abf29b954bb7 --- mogan/tests/tempest/api/test_flavors.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mogan/tests/tempest/api/test_flavors.py b/mogan/tests/tempest/api/test_flavors.py index 88832c23..090d13c2 100644 --- a/mogan/tests/tempest/api/test_flavors.py +++ b/mogan/tests/tempest/api/test_flavors.py @@ -14,7 +14,6 @@ import six -from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc @@ -26,10 +25,10 @@ class BaremetalComputeAPITest(base.BaseBaremetalComputeTest): @classmethod def resource_setup(cls): super(BaremetalComputeAPITest, cls).resource_setup() - for i in six.moves.xrange(3): - body = {"name": data_utils.rand_name('mogan_flavor'), + for i in six.moves.xrange(2): + body = {"name": "mogan_flavor_" + {0: 'public', 1: 'private'}[i], "description": "mogan flavor description", - 'is_public': bool(data_utils.rand_int_id(0, 1))} + 'is_public': not bool(i)} resp = cls.baremetal_compute_client.create_flavor(**body) cls.flavor_ids.append(resp['uuid']) @@ -65,7 +64,7 @@ class BaremetalComputeAPITest(base.BaseBaremetalComputeTest): @decorators.idempotent_id('ab1a5147-0e3e-4a29-8c28-505d29fac8dd') def test_flavor_show(self): resp = self.baremetal_compute_client.show_flavor(self.flavor_ids[0]) - self.assertIn('name', resp) + self.assertIn('mogan_flavor_public', resp['name']) self.assertEqual('mogan flavor description', resp['description']) self.assertEqual(True, resp['is_public'])