Merge "Refactor unit tests for project and domain with fake classes in identityv3"

This commit is contained in:
Jenkins 2016-07-06 04:08:03 +00:00 committed by Gerrit Code Review
commit 4ce7dd53e8
3 changed files with 343 additions and 298 deletions

View File

@ -15,6 +15,7 @@
import copy import copy
import mock import mock
import uuid
from keystoneauth1 import access from keystoneauth1 import access
from keystoneauth1 import fixture from keystoneauth1 import fixture
@ -575,3 +576,66 @@ class TestOAuth1(utils.TestCommand):
endpoint=fakes.AUTH_URL, endpoint=fakes.AUTH_URL,
token=fakes.AUTH_TOKEN token=fakes.AUTH_TOKEN
) )
class FakeProject(object):
"""Fake one or more project."""
@staticmethod
def create_one_project(attrs=None):
"""Create a fake project.
:param Dictionary attrs:
A dictionary with all attributes
:return:
A FakeResource object, with id, name, and so on
"""
attrs = attrs or {}
# set default attributes.
project_info = {
'id': 'project-id-' + uuid.uuid4().hex,
'name': 'project-name-' + uuid.uuid4().hex,
'description': 'project-description-' + uuid.uuid4().hex,
'enabled': True,
'is_domain': False,
'domain_id': 'domain-id-' + uuid.uuid4().hex,
'parent_id': 'parent-id-' + uuid.uuid4().hex,
'links': 'links-' + uuid.uuid4().hex,
}
project_info.update(attrs)
project = fakes.FakeResource(info=copy.deepcopy(project_info),
loaded=True)
return project
class FakeDomain(object):
"""Fake one or more domain."""
@staticmethod
def create_one_domain(attrs=None):
"""Create a fake domain.
:param Dictionary attrs:
A dictionary with all attributes
:return:
A FakeResource object, with id, name, and so on
"""
attrs = attrs or {}
# set default attributes.
domain_info = {
'id': 'domain-id-' + uuid.uuid4().hex,
'name': 'domain-name-' + uuid.uuid4().hex,
'description': 'domain-description-' + uuid.uuid4().hex,
'enabled': True,
'links': 'links-' + uuid.uuid4().hex,
}
domain_info.update(attrs)
domain = fakes.FakeResource(info=copy.deepcopy(domain_info),
loaded=True)
return domain

View File

@ -10,10 +10,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import copy
from openstackclient.identity.v3 import domain from openstackclient.identity.v3 import domain
from openstackclient.tests import fakes
from openstackclient.tests.identity.v3 import fakes as identity_fakes from openstackclient.tests.identity.v3 import fakes as identity_fakes
@ -35,20 +32,17 @@ class TestDomainCreate(TestDomain):
'id', 'id',
'name', 'name',
) )
datalist = (
identity_fakes.domain_description,
True,
identity_fakes.domain_id,
identity_fakes.domain_name,
)
def setUp(self): def setUp(self):
super(TestDomainCreate, self).setUp() super(TestDomainCreate, self).setUp()
self.domains_mock.create.return_value = fakes.FakeResource( self.domain = identity_fakes.FakeDomain.create_one_domain()
None, self.domains_mock.create.return_value = self.domain
copy.deepcopy(identity_fakes.DOMAIN), self.datalist = (
loaded=True, self.domain.description,
True,
self.domain.id,
self.domain.name,
) )
# Get the command object to test # Get the command object to test
@ -56,10 +50,10 @@ class TestDomainCreate(TestDomain):
def test_domain_create_no_options(self): def test_domain_create_no_options(self):
arglist = [ arglist = [
identity_fakes.domain_name, self.domain.name,
] ]
verifylist = [ verifylist = [
('name', identity_fakes.domain_name), ('name', self.domain.name),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -70,7 +64,7 @@ class TestDomainCreate(TestDomain):
# Set expected values # Set expected values
kwargs = { kwargs = {
'name': identity_fakes.domain_name, 'name': self.domain.name,
'description': None, 'description': None,
'enabled': True, 'enabled': True,
} }
@ -84,11 +78,11 @@ class TestDomainCreate(TestDomain):
def test_domain_create_description(self): def test_domain_create_description(self):
arglist = [ arglist = [
'--description', 'new desc', '--description', 'new desc',
identity_fakes.domain_name, self.domain.name,
] ]
verifylist = [ verifylist = [
('description', 'new desc'), ('description', 'new desc'),
('name', identity_fakes.domain_name), ('name', self.domain.name),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -99,7 +93,7 @@ class TestDomainCreate(TestDomain):
# Set expected values # Set expected values
kwargs = { kwargs = {
'name': identity_fakes.domain_name, 'name': self.domain.name,
'description': 'new desc', 'description': 'new desc',
'enabled': True, 'enabled': True,
} }
@ -113,11 +107,11 @@ class TestDomainCreate(TestDomain):
def test_domain_create_enable(self): def test_domain_create_enable(self):
arglist = [ arglist = [
'--enable', '--enable',
identity_fakes.domain_name, self.domain.name,
] ]
verifylist = [ verifylist = [
('enable', True), ('enable', True),
('name', identity_fakes.domain_name), ('name', self.domain.name),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -128,7 +122,7 @@ class TestDomainCreate(TestDomain):
# Set expected values # Set expected values
kwargs = { kwargs = {
'name': identity_fakes.domain_name, 'name': self.domain.name,
'description': None, 'description': None,
'enabled': True, 'enabled': True,
} }
@ -142,11 +136,11 @@ class TestDomainCreate(TestDomain):
def test_domain_create_disable(self): def test_domain_create_disable(self):
arglist = [ arglist = [
'--disable', '--disable',
identity_fakes.domain_name, self.domain.name,
] ]
verifylist = [ verifylist = [
('disable', True), ('disable', True),
('name', identity_fakes.domain_name), ('name', self.domain.name),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -157,7 +151,7 @@ class TestDomainCreate(TestDomain):
# Set expected values # Set expected values
kwargs = { kwargs = {
'name': identity_fakes.domain_name, 'name': self.domain.name,
'description': None, 'description': None,
'enabled': False, 'enabled': False,
} }
@ -171,15 +165,13 @@ class TestDomainCreate(TestDomain):
class TestDomainDelete(TestDomain): class TestDomainDelete(TestDomain):
domain = identity_fakes.FakeDomain.create_one_domain()
def setUp(self): def setUp(self):
super(TestDomainDelete, self).setUp() super(TestDomainDelete, self).setUp()
# This is the return value for utils.find_resource() # This is the return value for utils.find_resource()
self.domains_mock.get.return_value = fakes.FakeResource( self.domains_mock.get.return_value = self.domain
None,
copy.deepcopy(identity_fakes.DOMAIN),
loaded=True,
)
self.domains_mock.delete.return_value = None self.domains_mock.delete.return_value = None
# Get the command object to test # Get the command object to test
@ -187,33 +179,29 @@ class TestDomainDelete(TestDomain):
def test_domain_delete(self): def test_domain_delete(self):
arglist = [ arglist = [
identity_fakes.domain_id, self.domain.id,
] ]
verifylist = [ verifylist = [
('domain', identity_fakes.domain_id), ('domain', self.domain.id),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
self.domains_mock.delete.assert_called_with( self.domains_mock.delete.assert_called_with(
identity_fakes.domain_id, self.domain.id,
) )
self.assertIsNone(result) self.assertIsNone(result)
class TestDomainList(TestDomain): class TestDomainList(TestDomain):
domain = identity_fakes.FakeDomain.create_one_domain()
def setUp(self): def setUp(self):
super(TestDomainList, self).setUp() super(TestDomainList, self).setUp()
self.domains_mock.list.return_value = [ self.domains_mock.list.return_value = [self.domain]
fakes.FakeResource(
None,
copy.deepcopy(identity_fakes.DOMAIN),
loaded=True,
),
]
# Get the command object to test # Get the command object to test
self.cmd = domain.ListDomain(self.app, None) self.cmd = domain.ListDomain(self.app, None)
@ -232,40 +220,34 @@ class TestDomainList(TestDomain):
collist = ('ID', 'Name', 'Enabled', 'Description') collist = ('ID', 'Name', 'Enabled', 'Description')
self.assertEqual(collist, columns) self.assertEqual(collist, columns)
datalist = (( datalist = ((
identity_fakes.domain_id, self.domain.id,
identity_fakes.domain_name, self.domain.name,
True, True,
identity_fakes.domain_description, self.domain.description,
), ) ), )
self.assertEqual(datalist, tuple(data)) self.assertEqual(datalist, tuple(data))
class TestDomainSet(TestDomain): class TestDomainSet(TestDomain):
domain = identity_fakes.FakeDomain.create_one_domain()
def setUp(self): def setUp(self):
super(TestDomainSet, self).setUp() super(TestDomainSet, self).setUp()
self.domains_mock.get.return_value = fakes.FakeResource( self.domains_mock.get.return_value = self.domain
None,
copy.deepcopy(identity_fakes.DOMAIN),
loaded=True,
)
self.domains_mock.update.return_value = fakes.FakeResource( self.domains_mock.update.return_value = self.domain
None,
copy.deepcopy(identity_fakes.DOMAIN),
loaded=True,
)
# Get the command object to test # Get the command object to test
self.cmd = domain.SetDomain(self.app, None) self.cmd = domain.SetDomain(self.app, None)
def test_domain_set_no_options(self): def test_domain_set_no_options(self):
arglist = [ arglist = [
identity_fakes.domain_name, self.domain.name,
] ]
verifylist = [ verifylist = [
('domain', identity_fakes.domain_name), ('domain', self.domain.name),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -277,11 +259,11 @@ class TestDomainSet(TestDomain):
def test_domain_set_name(self): def test_domain_set_name(self):
arglist = [ arglist = [
'--name', 'qwerty', '--name', 'qwerty',
identity_fakes.domain_id, self.domain.id,
] ]
verifylist = [ verifylist = [
('name', 'qwerty'), ('name', 'qwerty'),
('domain', identity_fakes.domain_id), ('domain', self.domain.id),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -292,7 +274,7 @@ class TestDomainSet(TestDomain):
'name': 'qwerty', 'name': 'qwerty',
} }
self.domains_mock.update.assert_called_with( self.domains_mock.update.assert_called_with(
identity_fakes.domain_id, self.domain.id,
**kwargs **kwargs
) )
self.assertIsNone(result) self.assertIsNone(result)
@ -300,11 +282,11 @@ class TestDomainSet(TestDomain):
def test_domain_set_description(self): def test_domain_set_description(self):
arglist = [ arglist = [
'--description', 'new desc', '--description', 'new desc',
identity_fakes.domain_id, self.domain.id,
] ]
verifylist = [ verifylist = [
('description', 'new desc'), ('description', 'new desc'),
('domain', identity_fakes.domain_id), ('domain', self.domain.id),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -315,7 +297,7 @@ class TestDomainSet(TestDomain):
'description': 'new desc', 'description': 'new desc',
} }
self.domains_mock.update.assert_called_with( self.domains_mock.update.assert_called_with(
identity_fakes.domain_id, self.domain.id,
**kwargs **kwargs
) )
self.assertIsNone(result) self.assertIsNone(result)
@ -323,11 +305,11 @@ class TestDomainSet(TestDomain):
def test_domain_set_enable(self): def test_domain_set_enable(self):
arglist = [ arglist = [
'--enable', '--enable',
identity_fakes.domain_id, self.domain.id,
] ]
verifylist = [ verifylist = [
('enable', True), ('enable', True),
('domain', identity_fakes.domain_id), ('domain', self.domain.id),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -338,7 +320,7 @@ class TestDomainSet(TestDomain):
'enabled': True, 'enabled': True,
} }
self.domains_mock.update.assert_called_with( self.domains_mock.update.assert_called_with(
identity_fakes.domain_id, self.domain.id,
**kwargs **kwargs
) )
self.assertIsNone(result) self.assertIsNone(result)
@ -346,11 +328,11 @@ class TestDomainSet(TestDomain):
def test_domain_set_disable(self): def test_domain_set_disable(self):
arglist = [ arglist = [
'--disable', '--disable',
identity_fakes.domain_id, self.domain.id,
] ]
verifylist = [ verifylist = [
('disable', True), ('disable', True),
('domain', identity_fakes.domain_id), ('domain', self.domain.id),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -361,7 +343,7 @@ class TestDomainSet(TestDomain):
'enabled': False, 'enabled': False,
} }
self.domains_mock.update.assert_called_with( self.domains_mock.update.assert_called_with(
identity_fakes.domain_id, self.domain.id,
**kwargs **kwargs
) )
self.assertIsNone(result) self.assertIsNone(result)
@ -372,21 +354,17 @@ class TestDomainShow(TestDomain):
def setUp(self): def setUp(self):
super(TestDomainShow, self).setUp() super(TestDomainShow, self).setUp()
self.domains_mock.get.return_value = fakes.FakeResource( self.domain = identity_fakes.FakeDomain.create_one_domain()
None, self.domains_mock.get.return_value = self.domain
copy.deepcopy(identity_fakes.DOMAIN),
loaded=True,
)
# Get the command object to test # Get the command object to test
self.cmd = domain.ShowDomain(self.app, None) self.cmd = domain.ShowDomain(self.app, None)
def test_domain_show(self): def test_domain_show(self):
arglist = [ arglist = [
identity_fakes.domain_id, self.domain.id,
] ]
verifylist = [ verifylist = [
('domain', identity_fakes.domain_id), ('domain', self.domain.id),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.app.client_manager.identity.tokens.get_token_data.return_value = \ self.app.client_manager.identity.tokens.get_token_data.return_value = \
@ -405,15 +383,15 @@ class TestDomainShow(TestDomain):
# data to be shown. # data to be shown.
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.domains_mock.get.assert_called_with( self.domains_mock.get.assert_called_with(
identity_fakes.domain_id, self.domain.id,
) )
collist = ('description', 'enabled', 'id', 'name') collist = ('description', 'enabled', 'id', 'name')
self.assertEqual(collist, columns) self.assertEqual(collist, columns)
datalist = ( datalist = (
identity_fakes.domain_description, self.domain.description,
True, True,
identity_fakes.domain_id, self.domain.id,
identity_fakes.domain_name, self.domain.name,
) )
self.assertEqual(datalist, data) self.assertEqual(datalist, data)

View File

@ -13,14 +13,12 @@
# under the License. # under the License.
# #
import copy
import mock import mock
from osc_lib import exceptions from osc_lib import exceptions
import testtools import testtools
from openstackclient.identity.v3 import project from openstackclient.identity.v3 import project
from openstackclient.tests import fakes
from openstackclient.tests.identity.v3 import fakes as identity_fakes from openstackclient.tests.identity.v3 import fakes as identity_fakes
@ -40,48 +38,46 @@ class TestProject(identity_fakes.TestIdentityv3):
class TestProjectCreate(TestProject): class TestProjectCreate(TestProject):
domain = identity_fakes.FakeDomain.create_one_domain()
columns = ( columns = (
'description', 'description',
'domain_id', 'domain_id',
'enabled', 'enabled',
'id', 'id',
'name' 'is_domain',
) 'name',
datalist = ( 'parent_id',
identity_fakes.project_description,
identity_fakes.domain_id,
True,
identity_fakes.project_id,
identity_fakes.project_name,
) )
def setUp(self): def setUp(self):
super(TestProjectCreate, self).setUp() super(TestProjectCreate, self).setUp()
self.domains_mock.get.return_value = fakes.FakeResource( self.project = identity_fakes.FakeProject.create_one_project(
None, attrs={'domain_id': self.domain.id})
copy.deepcopy(identity_fakes.DOMAIN), self.domains_mock.get.return_value = self.domain
loaded=True, self.projects_mock.create.return_value = self.project
self.datalist = (
self.project.description,
self.project.domain_id,
True,
self.project.id,
False,
self.project.name,
self.project.parent_id,
) )
self.projects_mock.create.return_value = fakes.FakeResource(
None,
copy.deepcopy(identity_fakes.PROJECT),
loaded=True,
)
# Get the command object to test # Get the command object to test
self.cmd = project.CreateProject(self.app, None) self.cmd = project.CreateProject(self.app, None)
def test_project_create_no_options(self): def test_project_create_no_options(self):
arglist = [ arglist = [
identity_fakes.project_name, self.project.name,
] ]
verifylist = [ verifylist = [
('parent', None), ('parent', None),
('enable', False), ('enable', False),
('disable', False), ('disable', False),
('name', identity_fakes.project_name), ('name', self.project.name),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -92,7 +88,7 @@ class TestProjectCreate(TestProject):
# Set expected values # Set expected values
kwargs = { kwargs = {
'name': identity_fakes.project_name, 'name': self.project.name,
'domain': None, 'domain': None,
'description': None, 'description': None,
'enabled': True, 'enabled': True,
@ -104,27 +100,37 @@ class TestProjectCreate(TestProject):
**kwargs **kwargs
) )
collist = ('description', 'domain_id', 'enabled', 'id', 'name') collist = (
'description',
'domain_id',
'enabled',
'id',
'is_domain',
'name',
'parent_id',
)
self.assertEqual(collist, columns) self.assertEqual(collist, columns)
datalist = ( datalist = (
identity_fakes.project_description, self.project.description,
identity_fakes.domain_id, self.project.domain_id,
True, True,
identity_fakes.project_id, self.project.id,
identity_fakes.project_name, False,
self.project.name,
self.project.parent_id,
) )
self.assertEqual(datalist, data) self.assertEqual(datalist, data)
def test_project_create_description(self): def test_project_create_description(self):
arglist = [ arglist = [
'--description', 'new desc', '--description', 'new desc',
identity_fakes.project_name, self.project.name,
] ]
verifylist = [ verifylist = [
('description', 'new desc'), ('description', 'new desc'),
('enable', False), ('enable', False),
('disable', False), ('disable', False),
('name', identity_fakes.project_name), ('name', self.project.name),
('parent', None), ('parent', None),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -136,7 +142,7 @@ class TestProjectCreate(TestProject):
# Set expected values # Set expected values
kwargs = { kwargs = {
'name': identity_fakes.project_name, 'name': self.project.name,
'domain': None, 'domain': None,
'description': 'new desc', 'description': 'new desc',
'enabled': True, 'enabled': True,
@ -153,14 +159,14 @@ class TestProjectCreate(TestProject):
def test_project_create_domain(self): def test_project_create_domain(self):
arglist = [ arglist = [
'--domain', identity_fakes.domain_name, '--domain', self.project.domain_id,
identity_fakes.project_name, self.project.name,
] ]
verifylist = [ verifylist = [
('domain', identity_fakes.domain_name), ('domain', self.project.domain_id),
('enable', False), ('enable', False),
('disable', False), ('disable', False),
('name', identity_fakes.project_name), ('name', self.project.name),
('parent', None), ('parent', None),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -172,8 +178,8 @@ class TestProjectCreate(TestProject):
# Set expected values # Set expected values
kwargs = { kwargs = {
'name': identity_fakes.project_name, 'name': self.project.name,
'domain': identity_fakes.domain_id, 'domain': self.project.domain_id,
'description': None, 'description': None,
'enabled': True, 'enabled': True,
'parent': None, 'parent': None,
@ -189,14 +195,14 @@ class TestProjectCreate(TestProject):
def test_project_create_domain_no_perms(self): def test_project_create_domain_no_perms(self):
arglist = [ arglist = [
'--domain', identity_fakes.domain_id, '--domain', self.project.domain_id,
identity_fakes.project_name, self.project.name,
] ]
verifylist = [ verifylist = [
('domain', identity_fakes.domain_id), ('domain', self.project.domain_id),
('enable', False), ('enable', False),
('disable', False), ('disable', False),
('name', identity_fakes.project_name), ('name', self.project.name),
('parent', None), ('parent', None),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -208,8 +214,8 @@ class TestProjectCreate(TestProject):
# Set expected values # Set expected values
kwargs = { kwargs = {
'name': identity_fakes.project_name, 'name': self.project.name,
'domain': identity_fakes.domain_id, 'domain': self.project.domain_id,
'description': None, 'description': None,
'enabled': True, 'enabled': True,
'parent': None, 'parent': None,
@ -223,12 +229,12 @@ class TestProjectCreate(TestProject):
def test_project_create_enable(self): def test_project_create_enable(self):
arglist = [ arglist = [
'--enable', '--enable',
identity_fakes.project_name, self.project.name,
] ]
verifylist = [ verifylist = [
('enable', True), ('enable', True),
('disable', False), ('disable', False),
('name', identity_fakes.project_name), ('name', self.project.name),
('parent', None), ('parent', None),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -240,7 +246,7 @@ class TestProjectCreate(TestProject):
# Set expected values # Set expected values
kwargs = { kwargs = {
'name': identity_fakes.project_name, 'name': self.project.name,
'domain': None, 'domain': None,
'description': None, 'description': None,
'enabled': True, 'enabled': True,
@ -258,12 +264,12 @@ class TestProjectCreate(TestProject):
def test_project_create_disable(self): def test_project_create_disable(self):
arglist = [ arglist = [
'--disable', '--disable',
identity_fakes.project_name, self.project.name,
] ]
verifylist = [ verifylist = [
('enable', False), ('enable', False),
('disable', True), ('disable', True),
('name', identity_fakes.project_name), ('name', self.project.name),
('parent', None), ('parent', None),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -275,7 +281,7 @@ class TestProjectCreate(TestProject):
# Set expected values # Set expected values
kwargs = { kwargs = {
'name': identity_fakes.project_name, 'name': self.project.name,
'domain': None, 'domain': None,
'description': None, 'description': None,
'enabled': False, 'enabled': False,
@ -294,11 +300,11 @@ class TestProjectCreate(TestProject):
arglist = [ arglist = [
'--property', 'fee=fi', '--property', 'fee=fi',
'--property', 'fo=fum', '--property', 'fo=fum',
identity_fakes.project_name, self.project.name,
] ]
verifylist = [ verifylist = [
('property', {'fee': 'fi', 'fo': 'fum'}), ('property', {'fee': 'fi', 'fo': 'fum'}),
('name', identity_fakes.project_name), ('name', self.project.name),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -309,7 +315,7 @@ class TestProjectCreate(TestProject):
# Set expected values # Set expected values
kwargs = { kwargs = {
'name': identity_fakes.project_name, 'name': self.project.name,
'domain': None, 'domain': None,
'description': None, 'description': None,
'enabled': True, 'enabled': True,
@ -327,37 +333,32 @@ class TestProjectCreate(TestProject):
self.assertEqual(self.datalist, data) self.assertEqual(self.datalist, data)
def test_project_create_parent(self): def test_project_create_parent(self):
self.projects_mock.get.return_value = fakes.FakeResource( self.parent = identity_fakes.FakeProject.create_one_project()
None, self.project = identity_fakes.FakeProject.create_one_project(
copy.deepcopy(identity_fakes.PROJECT), attrs={'domain_id': self.domain.id, 'parent_id': self.parent.id})
loaded=True, self.projects_mock.get.return_value = self.parent
) self.projects_mock.create.return_value = self.project
self.projects_mock.create.return_value = fakes.FakeResource(
None,
copy.deepcopy(identity_fakes.PROJECT_WITH_PARENT),
loaded=True,
)
arglist = [ arglist = [
'--domain', identity_fakes.PROJECT_WITH_PARENT['domain_id'], '--domain', self.project.domain_id,
'--parent', identity_fakes.PROJECT['name'], '--parent', self.parent.name,
identity_fakes.PROJECT_WITH_PARENT['name'], self.project.name,
] ]
verifylist = [ verifylist = [
('domain', identity_fakes.PROJECT_WITH_PARENT['domain_id']), ('domain', self.project.domain_id),
('parent', identity_fakes.PROJECT['name']), ('parent', self.parent.name),
('enable', False), ('enable', False),
('disable', False), ('disable', False),
('name', identity_fakes.PROJECT_WITH_PARENT['name']), ('name', self.project.name),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
kwargs = { kwargs = {
'name': identity_fakes.PROJECT_WITH_PARENT['name'], 'name': self.project.name,
'domain': identity_fakes.PROJECT_WITH_PARENT['domain_id'], 'domain': self.project.domain_id,
'parent': identity_fakes.PROJECT['id'], 'parent': self.parent.id,
'description': None, 'description': None,
'enabled': True, 'enabled': True,
} }
@ -371,17 +372,19 @@ class TestProjectCreate(TestProject):
'domain_id', 'domain_id',
'enabled', 'enabled',
'id', 'id',
'is_domain',
'name', 'name',
'parent_id', 'parent_id',
) )
self.assertEqual(columns, collist) self.assertEqual(columns, collist)
datalist = ( datalist = (
identity_fakes.PROJECT_WITH_PARENT['description'], self.project.description,
identity_fakes.PROJECT_WITH_PARENT['domain_id'], self.project.domain_id,
identity_fakes.PROJECT_WITH_PARENT['enabled'], self.project.enabled,
identity_fakes.PROJECT_WITH_PARENT['id'], self.project.id,
identity_fakes.PROJECT_WITH_PARENT['name'], self.project.is_domain,
identity_fakes.PROJECT['id'], self.project.name,
self.parent.id,
) )
self.assertEqual(data, datalist) self.assertEqual(data, datalist)
@ -393,16 +396,16 @@ class TestProjectCreate(TestProject):
'Invalid parent') 'Invalid parent')
arglist = [ arglist = [
'--domain', identity_fakes.domain_name, '--domain', self.project.domain_id,
'--parent', 'invalid', '--parent', 'invalid',
identity_fakes.project_name, self.project.name,
] ]
verifylist = [ verifylist = [
('domain', identity_fakes.domain_name), ('domain', self.project.domain_id),
('parent', 'invalid'), ('parent', 'invalid'),
('enable', False), ('enable', False),
('disable', False), ('disable', False),
('name', identity_fakes.project_name), ('name', self.project.name),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -415,15 +418,13 @@ class TestProjectCreate(TestProject):
class TestProjectDelete(TestProject): class TestProjectDelete(TestProject):
project = identity_fakes.FakeProject.create_one_project()
def setUp(self): def setUp(self):
super(TestProjectDelete, self).setUp() super(TestProjectDelete, self).setUp()
# This is the return value for utils.find_resource() # This is the return value for utils.find_resource()
self.projects_mock.get.return_value = fakes.FakeResource( self.projects_mock.get.return_value = self.project
None,
copy.deepcopy(identity_fakes.PROJECT),
loaded=True,
)
self.projects_mock.delete.return_value = None self.projects_mock.delete.return_value = None
# Get the command object to test # Get the command object to test
@ -431,44 +432,42 @@ class TestProjectDelete(TestProject):
def test_project_delete_no_options(self): def test_project_delete_no_options(self):
arglist = [ arglist = [
identity_fakes.project_id, self.project.id,
] ]
verifylist = [ verifylist = [
('projects', [identity_fakes.project_id]), ('projects', [self.project.id]),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
self.projects_mock.delete.assert_called_with( self.projects_mock.delete.assert_called_with(
identity_fakes.project_id, self.project.id,
) )
self.assertIsNone(result) self.assertIsNone(result)
class TestProjectList(TestProject): class TestProjectList(TestProject):
domain = identity_fakes.FakeDomain.create_one_domain()
project = identity_fakes.FakeProject.create_one_project(
attrs={'domain_id': domain.id})
columns = ( columns = (
'ID', 'ID',
'Name', 'Name',
) )
datalist = ( datalist = (
( (
identity_fakes.project_id, project.id,
identity_fakes.project_name, project.name,
), ),
) )
def setUp(self): def setUp(self):
super(TestProjectList, self).setUp() super(TestProjectList, self).setUp()
self.projects_mock.list.return_value = [ self.projects_mock.list.return_value = [self.project]
fakes.FakeResource(
None,
copy.deepcopy(identity_fakes.PROJECT),
loaded=True,
),
]
# Get the command object to test # Get the command object to test
self.cmd = project.ListProject(self.app, None) self.cmd = project.ListProject(self.app, None)
@ -505,27 +504,23 @@ class TestProjectList(TestProject):
collist = ('ID', 'Name', 'Domain ID', 'Description', 'Enabled') collist = ('ID', 'Name', 'Domain ID', 'Description', 'Enabled')
self.assertEqual(collist, columns) self.assertEqual(collist, columns)
datalist = (( datalist = ((
identity_fakes.project_id, self.project.id,
identity_fakes.project_name, self.project.name,
identity_fakes.domain_id, self.project.domain_id,
identity_fakes.project_description, self.project.description,
True, True,
), ) ), )
self.assertEqual(datalist, tuple(data)) self.assertEqual(datalist, tuple(data))
def test_project_list_domain(self): def test_project_list_domain(self):
arglist = [ arglist = [
'--domain', identity_fakes.domain_name, '--domain', self.project.domain_id,
] ]
verifylist = [ verifylist = [
('domain', identity_fakes.domain_name), ('domain', self.project.domain_id),
] ]
self.domains_mock.get.return_value = fakes.FakeResource( self.domains_mock.get.return_value = self.domain
None,
copy.deepcopy(identity_fakes.DOMAIN),
loaded=True,
)
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -534,17 +529,17 @@ class TestProjectList(TestProject):
# containing the data to be listed. # containing the data to be listed.
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.projects_mock.list.assert_called_with( self.projects_mock.list.assert_called_with(
domain=identity_fakes.domain_id) domain=self.project.domain_id)
self.assertEqual(self.columns, columns) self.assertEqual(self.columns, columns)
self.assertEqual(self.datalist, tuple(data)) self.assertEqual(self.datalist, tuple(data))
def test_project_list_domain_no_perms(self): def test_project_list_domain_no_perms(self):
arglist = [ arglist = [
'--domain', identity_fakes.domain_id, '--domain', self.project.domain_id,
] ]
verifylist = [ verifylist = [
('domain', identity_fakes.domain_id), ('domain', self.project.domain_id),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
mocker = mock.Mock() mocker = mock.Mock()
@ -554,42 +549,34 @@ class TestProjectList(TestProject):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.projects_mock.list.assert_called_with( self.projects_mock.list.assert_called_with(
domain=identity_fakes.domain_id) domain=self.project.domain_id)
self.assertEqual(self.columns, columns) self.assertEqual(self.columns, columns)
self.assertEqual(self.datalist, tuple(data)) self.assertEqual(self.datalist, tuple(data))
class TestProjectSet(TestProject): class TestProjectSet(TestProject):
domain = identity_fakes.FakeDomain.create_one_domain()
project = identity_fakes.FakeProject.create_one_project(
attrs={'domain_id': domain.id})
def setUp(self): def setUp(self):
super(TestProjectSet, self).setUp() super(TestProjectSet, self).setUp()
self.domains_mock.get.return_value = fakes.FakeResource( self.domains_mock.get.return_value = self.domain
None,
copy.deepcopy(identity_fakes.DOMAIN),
loaded=True,
)
self.projects_mock.get.return_value = fakes.FakeResource( self.projects_mock.get.return_value = self.project
None, self.projects_mock.update.return_value = self.project
copy.deepcopy(identity_fakes.PROJECT),
loaded=True,
)
self.projects_mock.update.return_value = fakes.FakeResource(
None,
copy.deepcopy(identity_fakes.PROJECT),
loaded=True,
)
# Get the command object to test # Get the command object to test
self.cmd = project.SetProject(self.app, None) self.cmd = project.SetProject(self.app, None)
def test_project_set_no_options(self): def test_project_set_no_options(self):
arglist = [ arglist = [
identity_fakes.project_name, self.project.name,
] ]
verifylist = [ verifylist = [
('project', identity_fakes.project_name), ('project', self.project.name),
('enable', False), ('enable', False),
('disable', False), ('disable', False),
] ]
@ -602,15 +589,15 @@ class TestProjectSet(TestProject):
def test_project_set_name(self): def test_project_set_name(self):
arglist = [ arglist = [
'--name', 'qwerty', '--name', 'qwerty',
'--domain', identity_fakes.domain_id, '--domain', self.project.domain_id,
identity_fakes.project_name, self.project.name,
] ]
verifylist = [ verifylist = [
('name', 'qwerty'), ('name', 'qwerty'),
('domain', identity_fakes.domain_id), ('domain', self.project.domain_id),
('enable', False), ('enable', False),
('disable', False), ('disable', False),
('project', identity_fakes.project_name), ('project', self.project.name),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -623,23 +610,23 @@ class TestProjectSet(TestProject):
# ProjectManager.update(project, name=, domain=, description=, # ProjectManager.update(project, name=, domain=, description=,
# enabled=, **kwargs) # enabled=, **kwargs)
self.projects_mock.update.assert_called_with( self.projects_mock.update.assert_called_with(
identity_fakes.project_id, self.project.id,
**kwargs **kwargs
) )
self.assertIsNone(result) self.assertIsNone(result)
def test_project_set_description(self): def test_project_set_description(self):
arglist = [ arglist = [
'--domain', identity_fakes.domain_id, '--domain', self.project.domain_id,
'--description', 'new desc', '--description', 'new desc',
identity_fakes.project_name, self.project.name,
] ]
verifylist = [ verifylist = [
('domain', identity_fakes.domain_id), ('domain', self.project.domain_id),
('description', 'new desc'), ('description', 'new desc'),
('enable', False), ('enable', False),
('disable', False), ('disable', False),
('project', identity_fakes.project_name), ('project', self.project.name),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -650,22 +637,22 @@ class TestProjectSet(TestProject):
'description': 'new desc', 'description': 'new desc',
} }
self.projects_mock.update.assert_called_with( self.projects_mock.update.assert_called_with(
identity_fakes.project_id, self.project.id,
**kwargs **kwargs
) )
self.assertIsNone(result) self.assertIsNone(result)
def test_project_set_enable(self): def test_project_set_enable(self):
arglist = [ arglist = [
'--domain', identity_fakes.domain_id, '--domain', self.project.domain_id,
'--enable', '--enable',
identity_fakes.project_name, self.project.name,
] ]
verifylist = [ verifylist = [
('domain', identity_fakes.domain_id), ('domain', self.project.domain_id),
('enable', True), ('enable', True),
('disable', False), ('disable', False),
('project', identity_fakes.project_name), ('project', self.project.name),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -676,22 +663,22 @@ class TestProjectSet(TestProject):
'enabled': True, 'enabled': True,
} }
self.projects_mock.update.assert_called_with( self.projects_mock.update.assert_called_with(
identity_fakes.project_id, self.project.id,
**kwargs **kwargs
) )
self.assertIsNone(result) self.assertIsNone(result)
def test_project_set_disable(self): def test_project_set_disable(self):
arglist = [ arglist = [
'--domain', identity_fakes.domain_id, '--domain', self.project.domain_id,
'--disable', '--disable',
identity_fakes.project_name, self.project.name,
] ]
verifylist = [ verifylist = [
('domain', identity_fakes.domain_id), ('domain', self.project.domain_id),
('enable', False), ('enable', False),
('disable', True), ('disable', True),
('project', identity_fakes.project_name), ('project', self.project.name),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -702,22 +689,22 @@ class TestProjectSet(TestProject):
'enabled': False, 'enabled': False,
} }
self.projects_mock.update.assert_called_with( self.projects_mock.update.assert_called_with(
identity_fakes.project_id, self.project.id,
**kwargs **kwargs
) )
self.assertIsNone(result) self.assertIsNone(result)
def test_project_set_property(self): def test_project_set_property(self):
arglist = [ arglist = [
'--domain', identity_fakes.domain_id, '--domain', self.project.domain_id,
'--property', 'fee=fi', '--property', 'fee=fi',
'--property', 'fo=fum', '--property', 'fo=fum',
identity_fakes.project_name, self.project.name,
] ]
verifylist = [ verifylist = [
('domain', identity_fakes.domain_id), ('domain', self.project.domain_id),
('property', {'fee': 'fi', 'fo': 'fum'}), ('property', {'fee': 'fi', 'fo': 'fum'}),
('project', identity_fakes.project_name), ('project', self.project.name),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -729,7 +716,7 @@ class TestProjectSet(TestProject):
'fo': 'fum', 'fo': 'fum',
} }
self.projects_mock.update.assert_called_with( self.projects_mock.update.assert_called_with(
identity_fakes.project_id, self.project.id,
**kwargs **kwargs
) )
self.assertIsNone(result) self.assertIsNone(result)
@ -737,14 +724,14 @@ class TestProjectSet(TestProject):
class TestProjectShow(TestProject): class TestProjectShow(TestProject):
domain = identity_fakes.FakeDomain.create_one_domain()
def setUp(self): def setUp(self):
super(TestProjectShow, self).setUp() super(TestProjectShow, self).setUp()
self.projects_mock.get.return_value = fakes.FakeResource( self.project = identity_fakes.FakeProject.create_one_project(
None, attrs={'domain_id': self.domain.id})
copy.deepcopy(identity_fakes.PROJECT), self.projects_mock.get.return_value = self.project
loaded=True,
)
# Get the command object to test # Get the command object to test
self.cmd = project.ShowProject(self.app, None) self.cmd = project.ShowProject(self.app, None)
@ -753,10 +740,10 @@ class TestProjectShow(TestProject):
def test_project_show(self): def test_project_show(self):
arglist = [ arglist = [
identity_fakes.project_id, self.project.id,
] ]
verifylist = [ verifylist = [
('project', identity_fakes.project_id), ('project', self.project.id),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -775,38 +762,48 @@ class TestProjectShow(TestProject):
# data to be shown. # data to be shown.
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.projects_mock.get.assert_called_with( self.projects_mock.get.assert_called_with(
identity_fakes.project_id, self.project.id,
parents_as_list=False, parents_as_list=False,
subtree_as_list=False, subtree_as_list=False,
) )
collist = ('description', 'domain_id', 'enabled', 'id', 'name') collist = (
'description',
'domain_id',
'enabled',
'id',
'is_domain',
'name',
'parent_id',
)
self.assertEqual(collist, columns) self.assertEqual(collist, columns)
datalist = ( datalist = (
identity_fakes.project_description, self.project.description,
identity_fakes.domain_id, self.project.domain_id,
True, True,
identity_fakes.project_id, self.project.id,
identity_fakes.project_name, False,
self.project.name,
self.project.parent_id,
) )
self.assertEqual(datalist, data) self.assertEqual(datalist, data)
@testtools.skip("skip until bug 1599333 is fixed") @testtools.skip("skip until bug 1599333 is fixed")
def test_project_show_parents(self): def test_project_show_parents(self):
project = copy.deepcopy(identity_fakes.PROJECT_WITH_GRANDPARENT) self.project = identity_fakes.FakeProject.create_one_project(
project['parents'] = identity_fakes.grandparents attrs={
self.projects_mock.get.return_value = fakes.FakeResource( 'parent_id': self.project.parent_id,
None, 'parents': [{'project': {'id': self.project.parent_id}}]
project, }
loaded=True,
) )
self.projects_mock.get.return_value = self.project
arglist = [ arglist = [
identity_fakes.PROJECT_WITH_GRANDPARENT['id'], self.project.id,
'--parents', '--parents',
] ]
verifylist = [ verifylist = [
('project', identity_fakes.PROJECT_WITH_GRANDPARENT['id']), ('project', self.project.id),
('parents', True), ('parents', True),
('children', False), ('children', False),
] ]
@ -823,7 +820,7 @@ class TestProjectShow(TestProject):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.projects_mock.get.assert_called_with( self.projects_mock.get.assert_called_with(
identity_fakes.PROJECT_WITH_GRANDPARENT['id'], self.project.id,
parents_as_list=True, parents_as_list=True,
subtree_as_list=False, subtree_as_list=False,
) )
@ -833,38 +830,40 @@ class TestProjectShow(TestProject):
'domain_id', 'domain_id',
'enabled', 'enabled',
'id', 'id',
'is_domain',
'name', 'name',
'parent_id', 'parent_id',
'parents', 'parents',
) )
self.assertEqual(columns, collist) self.assertEqual(columns, collist)
datalist = ( datalist = (
identity_fakes.PROJECT_WITH_GRANDPARENT['description'], self.project.description,
identity_fakes.PROJECT_WITH_GRANDPARENT['domain_id'], self.project.domain_id,
identity_fakes.PROJECT_WITH_GRANDPARENT['enabled'], self.project.enabled,
identity_fakes.PROJECT_WITH_GRANDPARENT['id'], self.project.id,
identity_fakes.PROJECT_WITH_GRANDPARENT['name'], self.project.is_domain,
identity_fakes.PROJECT_WITH_GRANDPARENT['parent_id'], self.project.name,
identity_fakes.ids_for_parents_and_grandparents, self.project.parent_id,
[self.project.parent_id],
) )
self.assertEqual(data, datalist) self.assertEqual(data, datalist)
@testtools.skip("skip until bug 1599333 is fixed") @testtools.skip("skip until bug 1599333 is fixed")
def test_project_show_subtree(self): def test_project_show_subtree(self):
project = copy.deepcopy(identity_fakes.PROJECT_WITH_PARENT) self.project = identity_fakes.FakeProject.create_one_project(
project['subtree'] = identity_fakes.children attrs={
self.projects_mock.get.return_value = fakes.FakeResource( 'parent_id': self.project.parent_id,
None, 'subtree': [{'project': {'id': 'children-id'}}]
project, }
loaded=True,
) )
self.projects_mock.get.return_value = self.project
arglist = [ arglist = [
identity_fakes.PROJECT_WITH_PARENT['id'], self.project.id,
'--children', '--children',
] ]
verifylist = [ verifylist = [
('project', identity_fakes.PROJECT_WITH_PARENT['id']), ('project', self.project.id),
('parents', False), ('parents', False),
('children', True), ('children', True),
] ]
@ -881,7 +880,7 @@ class TestProjectShow(TestProject):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.projects_mock.get.assert_called_with( self.projects_mock.get.assert_called_with(
identity_fakes.PROJECT_WITH_PARENT['id'], self.project.id,
parents_as_list=False, parents_as_list=False,
subtree_as_list=True, subtree_as_list=True,
) )
@ -891,40 +890,42 @@ class TestProjectShow(TestProject):
'domain_id', 'domain_id',
'enabled', 'enabled',
'id', 'id',
'is_domain',
'name', 'name',
'parent_id', 'parent_id',
'subtree', 'subtree',
) )
self.assertEqual(columns, collist) self.assertEqual(columns, collist)
datalist = ( datalist = (
identity_fakes.PROJECT_WITH_PARENT['description'], self.project.description,
identity_fakes.PROJECT_WITH_PARENT['domain_id'], self.project.domain_id,
identity_fakes.PROJECT_WITH_PARENT['enabled'], self.project.enabled,
identity_fakes.PROJECT_WITH_PARENT['id'], self.project.id,
identity_fakes.PROJECT_WITH_PARENT['name'], self.project.is_domain,
identity_fakes.PROJECT_WITH_PARENT['parent_id'], self.project.name,
identity_fakes.ids_for_children, self.project.parent_id,
['children-id'],
) )
self.assertEqual(data, datalist) self.assertEqual(data, datalist)
@testtools.skip("skip until bug 1599333 is fixed") @testtools.skip("skip until bug 1599333 is fixed")
def test_project_show_parents_and_children(self): def test_project_show_parents_and_children(self):
project = copy.deepcopy(identity_fakes.PROJECT_WITH_PARENT) self.project = identity_fakes.FakeProject.create_one_project(
project['subtree'] = identity_fakes.children attrs={
project['parents'] = identity_fakes.parents 'parent_id': self.project.parent_id,
self.projects_mock.get.return_value = fakes.FakeResource( 'parents': [{'project': {'id': self.project.parent_id}}],
None, 'subtree': [{'project': {'id': 'children-id'}}]
project, }
loaded=True,
) )
self.projects_mock.get.return_value = self.project
arglist = [ arglist = [
identity_fakes.PROJECT_WITH_PARENT['id'], self.project.id,
'--parents', '--parents',
'--children', '--children',
] ]
verifylist = [ verifylist = [
('project', identity_fakes.PROJECT_WITH_PARENT['id']), ('project', self.project.id),
('parents', True), ('parents', True),
('children', True), ('children', True),
] ]
@ -941,7 +942,7 @@ class TestProjectShow(TestProject):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.projects_mock.get.assert_called_with( self.projects_mock.get.assert_called_with(
identity_fakes.PROJECT_WITH_PARENT['id'], self.project.id,
parents_as_list=True, parents_as_list=True,
subtree_as_list=True, subtree_as_list=True,
) )
@ -951,6 +952,7 @@ class TestProjectShow(TestProject):
'domain_id', 'domain_id',
'enabled', 'enabled',
'id', 'id',
'is_domain',
'name', 'name',
'parent_id', 'parent_id',
'parents', 'parents',
@ -958,13 +960,14 @@ class TestProjectShow(TestProject):
) )
self.assertEqual(columns, collist) self.assertEqual(columns, collist)
datalist = ( datalist = (
identity_fakes.PROJECT_WITH_PARENT['description'], self.project.description,
identity_fakes.PROJECT_WITH_PARENT['domain_id'], self.project.domain_id,
identity_fakes.PROJECT_WITH_PARENT['enabled'], self.project.enabled,
identity_fakes.PROJECT_WITH_PARENT['id'], self.project.id,
identity_fakes.PROJECT_WITH_PARENT['name'], self.project.is_domain,
identity_fakes.PROJECT_WITH_PARENT['parent_id'], self.project.name,
identity_fakes.ids_for_parents, self.project.parent_id,
identity_fakes.ids_for_children, [self.project.parent_id],
['children-id'],
) )
self.assertEqual(data, datalist) self.assertEqual(data, datalist)