Make all fixture project_ids into uuids
The Fernet tests for Python 3.4 fail if they are given project_ids that are not uuids. Since all issued project IDs in a live deployment are UUIDs, it is more correct to fix the tests than to change the formatter. Change-Id: I485c02cbb6484e52b4bb4563e2842c45a34e66eb
This commit is contained in:
parent
3a266929cf
commit
36da34f02f
|
@ -732,7 +732,8 @@ class TestCase(BaseTestCase):
|
||||||
fixtures_to_cleanup.append(attrname)
|
fixtures_to_cleanup.append(attrname)
|
||||||
|
|
||||||
for tenant in fixtures.TENANTS:
|
for tenant in fixtures.TENANTS:
|
||||||
if hasattr(self, 'tenant_%s' % tenant['id']):
|
tenant_attr_name = 'tenant_%s' % tenant['name'].lower()
|
||||||
|
if hasattr(self, tenant_attr_name):
|
||||||
try:
|
try:
|
||||||
# This will clear out any roles on the project as well
|
# This will clear out any roles on the project as well
|
||||||
self.resource_api.delete_project(tenant['id'])
|
self.resource_api.delete_project(tenant['id'])
|
||||||
|
@ -741,9 +742,8 @@ class TestCase(BaseTestCase):
|
||||||
rv = self.resource_api.create_project(
|
rv = self.resource_api.create_project(
|
||||||
tenant['id'], tenant)
|
tenant['id'], tenant)
|
||||||
|
|
||||||
attrname = 'tenant_%s' % tenant['id']
|
setattr(self, tenant_attr_name, rv)
|
||||||
setattr(self, attrname, rv)
|
fixtures_to_cleanup.append(tenant_attr_name)
|
||||||
fixtures_to_cleanup.append(attrname)
|
|
||||||
|
|
||||||
for role in fixtures.ROLES:
|
for role in fixtures.ROLES:
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -14,12 +14,17 @@
|
||||||
|
|
||||||
# NOTE(dolph): please try to avoid additional fixtures if possible; test suite
|
# NOTE(dolph): please try to avoid additional fixtures if possible; test suite
|
||||||
# performance may be negatively affected.
|
# performance may be negatively affected.
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
BAR_TENANT_ID = uuid.uuid4().hex
|
||||||
|
BAZ_TENANT_ID = uuid.uuid4().hex
|
||||||
|
MTU_TENANT_ID = uuid.uuid4().hex
|
||||||
|
SERVICE_TENANT_ID = uuid.uuid4().hex
|
||||||
DEFAULT_DOMAIN_ID = 'default'
|
DEFAULT_DOMAIN_ID = 'default'
|
||||||
|
|
||||||
TENANTS = [
|
TENANTS = [
|
||||||
{
|
{
|
||||||
'id': 'bar',
|
'id': BAR_TENANT_ID,
|
||||||
'name': 'BAR',
|
'name': 'BAR',
|
||||||
'domain_id': DEFAULT_DOMAIN_ID,
|
'domain_id': DEFAULT_DOMAIN_ID,
|
||||||
'description': 'description',
|
'description': 'description',
|
||||||
|
@ -27,7 +32,7 @@ TENANTS = [
|
||||||
'parent_id': DEFAULT_DOMAIN_ID,
|
'parent_id': DEFAULT_DOMAIN_ID,
|
||||||
'is_domain': False,
|
'is_domain': False,
|
||||||
}, {
|
}, {
|
||||||
'id': 'baz',
|
'id': BAZ_TENANT_ID,
|
||||||
'name': 'BAZ',
|
'name': 'BAZ',
|
||||||
'domain_id': DEFAULT_DOMAIN_ID,
|
'domain_id': DEFAULT_DOMAIN_ID,
|
||||||
'description': 'description',
|
'description': 'description',
|
||||||
|
@ -35,7 +40,7 @@ TENANTS = [
|
||||||
'parent_id': DEFAULT_DOMAIN_ID,
|
'parent_id': DEFAULT_DOMAIN_ID,
|
||||||
'is_domain': False,
|
'is_domain': False,
|
||||||
}, {
|
}, {
|
||||||
'id': 'mtu',
|
'id': MTU_TENANT_ID,
|
||||||
'name': 'MTU',
|
'name': 'MTU',
|
||||||
'description': 'description',
|
'description': 'description',
|
||||||
'enabled': True,
|
'enabled': True,
|
||||||
|
@ -43,7 +48,7 @@ TENANTS = [
|
||||||
'parent_id': DEFAULT_DOMAIN_ID,
|
'parent_id': DEFAULT_DOMAIN_ID,
|
||||||
'is_domain': False,
|
'is_domain': False,
|
||||||
}, {
|
}, {
|
||||||
'id': 'service',
|
'id': SERVICE_TENANT_ID,
|
||||||
'name': 'service',
|
'name': 'service',
|
||||||
'description': 'description',
|
'description': 'description',
|
||||||
'enabled': True,
|
'enabled': True,
|
||||||
|
@ -69,7 +74,7 @@ USERS = [
|
||||||
'name': 'FOO',
|
'name': 'FOO',
|
||||||
'domain_id': DEFAULT_DOMAIN_ID,
|
'domain_id': DEFAULT_DOMAIN_ID,
|
||||||
'password': 'foo2',
|
'password': 'foo2',
|
||||||
'tenants': ['bar'],
|
'tenants': [BAR_TENANT_ID],
|
||||||
'enabled': True,
|
'enabled': True,
|
||||||
'email': 'foo@bar.com',
|
'email': 'foo@bar.com',
|
||||||
}, {
|
}, {
|
||||||
|
@ -78,8 +83,8 @@ USERS = [
|
||||||
'domain_id': DEFAULT_DOMAIN_ID,
|
'domain_id': DEFAULT_DOMAIN_ID,
|
||||||
'password': 'two2',
|
'password': 'two2',
|
||||||
'enabled': True,
|
'enabled': True,
|
||||||
'default_project_id': 'baz',
|
'default_project_id': BAZ_TENANT_ID,
|
||||||
'tenants': ['baz'],
|
'tenants': [BAZ_TENANT_ID],
|
||||||
'email': 'two@three.com',
|
'email': 'two@three.com',
|
||||||
}, {
|
}, {
|
||||||
'id': 'badguy',
|
'id': 'badguy',
|
||||||
|
@ -87,8 +92,8 @@ USERS = [
|
||||||
'domain_id': DEFAULT_DOMAIN_ID,
|
'domain_id': DEFAULT_DOMAIN_ID,
|
||||||
'password': 'bad',
|
'password': 'bad',
|
||||||
'enabled': False,
|
'enabled': False,
|
||||||
'default_project_id': 'baz',
|
'default_project_id': BAZ_TENANT_ID,
|
||||||
'tenants': ['baz'],
|
'tenants': [BAZ_TENANT_ID],
|
||||||
'email': 'bad@guy.com',
|
'email': 'bad@guy.com',
|
||||||
}, {
|
}, {
|
||||||
'id': 'sna',
|
'id': 'sna',
|
||||||
|
@ -96,7 +101,7 @@ USERS = [
|
||||||
'domain_id': DEFAULT_DOMAIN_ID,
|
'domain_id': DEFAULT_DOMAIN_ID,
|
||||||
'password': 'snafu',
|
'password': 'snafu',
|
||||||
'enabled': True,
|
'enabled': True,
|
||||||
'tenants': ['bar'],
|
'tenants': [BAR_TENANT_ID],
|
||||||
'email': 'sna@snl.coom',
|
'email': 'sna@snl.coom',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -137,7 +142,7 @@ ROLES = [
|
||||||
ROLE_ASSIGNMENTS = [
|
ROLE_ASSIGNMENTS = [
|
||||||
{
|
{
|
||||||
'user': 'reqadmin',
|
'user': 'reqadmin',
|
||||||
'tenant_id': 'service',
|
'tenant_id': SERVICE_TENANT_ID,
|
||||||
'role_id': 'admin'
|
'role_id': 'admin'
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -223,7 +223,7 @@ class RestfulTestCase(unit.TestCase):
|
||||||
'username': self.user_reqadmin['name'],
|
'username': self.user_reqadmin['name'],
|
||||||
'password': self.user_reqadmin['password']
|
'password': self.user_reqadmin['password']
|
||||||
},
|
},
|
||||||
'tenantId': 'service'
|
'tenantId': default_fixtures.SERVICE_TENANT_ID
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ from testtools import matchers
|
||||||
|
|
||||||
from keystone.common import extension as keystone_extension
|
from keystone.common import extension as keystone_extension
|
||||||
from keystone.tests import unit
|
from keystone.tests import unit
|
||||||
|
from keystone.tests.unit import default_fixtures
|
||||||
from keystone.tests.unit import ksfixtures
|
from keystone.tests.unit import ksfixtures
|
||||||
from keystone.tests.unit import rest
|
from keystone.tests.unit import rest
|
||||||
from keystone.tests.unit.schema import v2
|
from keystone.tests.unit.schema import v2
|
||||||
|
@ -180,7 +181,8 @@ class CoreApiTests(object):
|
||||||
self.tenant_service['id'],
|
self.tenant_service['id'],
|
||||||
self.role_service['id'])
|
self.role_service['id'])
|
||||||
|
|
||||||
token = self.get_scoped_token(tenant_id='service')
|
token = self.get_scoped_token(
|
||||||
|
tenant_id=default_fixtures.SERVICE_TENANT_ID)
|
||||||
r = self.admin_request(
|
r = self.admin_request(
|
||||||
path='/v2.0/tokens/%s' % token,
|
path='/v2.0/tokens/%s' % token,
|
||||||
token=token)
|
token=token)
|
||||||
|
@ -192,7 +194,8 @@ class CoreApiTests(object):
|
||||||
self.tenant_service['id'],
|
self.tenant_service['id'],
|
||||||
self.role_service['id'])
|
self.role_service['id'])
|
||||||
|
|
||||||
token = self.get_scoped_token(tenant_id='service')
|
token = self.get_scoped_token(
|
||||||
|
tenant_id=default_fixtures.SERVICE_TENANT_ID)
|
||||||
r = self.admin_request(
|
r = self.admin_request(
|
||||||
path='/v2.0/tokens/%s' % token,
|
path='/v2.0/tokens/%s' % token,
|
||||||
token=token)
|
token=token)
|
||||||
|
|
Loading…
Reference in New Issue