Trivial: Reorder classes in identity v3 in alphabetical order
Change-Id: Iaf2e336c2415416ec69f6b974743c26509bba561
This commit is contained in:
parent
e3e2f38920
commit
2debde35ef
@ -136,45 +136,6 @@ class TestConsumerList(TestOAuth1):
|
||||
self.assertEqual(datalist, tuple(data))
|
||||
|
||||
|
||||
class TestConsumerShow(TestOAuth1):
|
||||
|
||||
def setUp(self):
|
||||
super(TestConsumerShow, self).setUp()
|
||||
|
||||
consumer_no_secret = copy.deepcopy(identity_fakes.OAUTH_CONSUMER)
|
||||
del consumer_no_secret['secret']
|
||||
self.consumers_mock.get.return_value = fakes.FakeResource(
|
||||
None,
|
||||
consumer_no_secret,
|
||||
loaded=True,
|
||||
)
|
||||
|
||||
# Get the command object to test
|
||||
self.cmd = consumer.ShowConsumer(self.app, None)
|
||||
|
||||
def test_consumer_show(self):
|
||||
arglist = [
|
||||
identity_fakes.consumer_id,
|
||||
]
|
||||
verifylist = [
|
||||
('consumer', identity_fakes.consumer_id),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.consumers_mock.get.assert_called_with(
|
||||
identity_fakes.consumer_id,
|
||||
)
|
||||
|
||||
collist = ('description', 'id')
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = (
|
||||
identity_fakes.consumer_description,
|
||||
identity_fakes.consumer_id,
|
||||
)
|
||||
self.assertEqual(datalist, data)
|
||||
|
||||
|
||||
class TestConsumerSet(TestOAuth1):
|
||||
|
||||
def setUp(self):
|
||||
@ -217,3 +178,42 @@ class TestConsumerSet(TestOAuth1):
|
||||
**kwargs
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
|
||||
|
||||
class TestConsumerShow(TestOAuth1):
|
||||
|
||||
def setUp(self):
|
||||
super(TestConsumerShow, self).setUp()
|
||||
|
||||
consumer_no_secret = copy.deepcopy(identity_fakes.OAUTH_CONSUMER)
|
||||
del consumer_no_secret['secret']
|
||||
self.consumers_mock.get.return_value = fakes.FakeResource(
|
||||
None,
|
||||
consumer_no_secret,
|
||||
loaded=True,
|
||||
)
|
||||
|
||||
# Get the command object to test
|
||||
self.cmd = consumer.ShowConsumer(self.app, None)
|
||||
|
||||
def test_consumer_show(self):
|
||||
arglist = [
|
||||
identity_fakes.consumer_id,
|
||||
]
|
||||
verifylist = [
|
||||
('consumer', identity_fakes.consumer_id),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.consumers_mock.get.assert_called_with(
|
||||
identity_fakes.consumer_id,
|
||||
)
|
||||
|
||||
collist = ('description', 'id')
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = (
|
||||
identity_fakes.consumer_description,
|
||||
identity_fakes.consumer_id,
|
||||
)
|
||||
self.assertEqual(datalist, data)
|
||||
|
@ -310,46 +310,6 @@ class TestIdentityProviderList(TestIdentityProvider):
|
||||
self.assertEqual(datalist, tuple(data))
|
||||
|
||||
|
||||
class TestIdentityProviderShow(TestIdentityProvider):
|
||||
|
||||
def setUp(self):
|
||||
super(TestIdentityProviderShow, self).setUp()
|
||||
|
||||
ret = fakes.FakeResource(
|
||||
None,
|
||||
copy.deepcopy(identity_fakes.IDENTITY_PROVIDER),
|
||||
loaded=True,
|
||||
)
|
||||
self.identity_providers_mock.get.return_value = ret
|
||||
# Get the command object to test
|
||||
self.cmd = identity_provider.ShowIdentityProvider(self.app, None)
|
||||
|
||||
def test_identity_provider_show(self):
|
||||
arglist = [
|
||||
identity_fakes.idp_id,
|
||||
]
|
||||
verifylist = [
|
||||
('identity_provider', identity_fakes.idp_id),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.identity_providers_mock.get.assert_called_with(
|
||||
identity_fakes.idp_id,
|
||||
)
|
||||
|
||||
collist = ('description', 'enabled', 'id', 'remote_ids')
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = (
|
||||
identity_fakes.idp_description,
|
||||
True,
|
||||
identity_fakes.idp_id,
|
||||
identity_fakes.formatted_idp_remote_ids
|
||||
)
|
||||
self.assertEqual(datalist, data)
|
||||
|
||||
|
||||
class TestIdentityProviderSet(TestIdentityProvider):
|
||||
|
||||
columns = (
|
||||
@ -627,3 +587,43 @@ class TestIdentityProviderSet(TestIdentityProvider):
|
||||
# neither --enable nor --disable was specified
|
||||
self.assertIsNone(columns)
|
||||
self.assertIsNone(data)
|
||||
|
||||
|
||||
class TestIdentityProviderShow(TestIdentityProvider):
|
||||
|
||||
def setUp(self):
|
||||
super(TestIdentityProviderShow, self).setUp()
|
||||
|
||||
ret = fakes.FakeResource(
|
||||
None,
|
||||
copy.deepcopy(identity_fakes.IDENTITY_PROVIDER),
|
||||
loaded=True,
|
||||
)
|
||||
self.identity_providers_mock.get.return_value = ret
|
||||
# Get the command object to test
|
||||
self.cmd = identity_provider.ShowIdentityProvider(self.app, None)
|
||||
|
||||
def test_identity_provider_show(self):
|
||||
arglist = [
|
||||
identity_fakes.idp_id,
|
||||
]
|
||||
verifylist = [
|
||||
('identity_provider', identity_fakes.idp_id),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.identity_providers_mock.get.assert_called_with(
|
||||
identity_fakes.idp_id,
|
||||
)
|
||||
|
||||
collist = ('description', 'enabled', 'id', 'remote_ids')
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = (
|
||||
identity_fakes.idp_description,
|
||||
True,
|
||||
identity_fakes.idp_id,
|
||||
identity_fakes.formatted_idp_remote_ids
|
||||
)
|
||||
self.assertEqual(datalist, data)
|
||||
|
@ -145,41 +145,6 @@ class TestMappingList(TestMapping):
|
||||
self.assertEqual(datalist, data)
|
||||
|
||||
|
||||
class TestMappingShow(TestMapping):
|
||||
|
||||
def setUp(self):
|
||||
super(TestMappingShow, self).setUp()
|
||||
|
||||
self.mapping_mock.get.return_value = fakes.FakeResource(
|
||||
None,
|
||||
copy.deepcopy(identity_fakes.MAPPING_RESPONSE),
|
||||
loaded=True
|
||||
)
|
||||
|
||||
self.cmd = mapping.ShowMapping(self.app, None)
|
||||
|
||||
def test_mapping_show(self):
|
||||
arglist = [
|
||||
identity_fakes.mapping_id
|
||||
]
|
||||
verifylist = [
|
||||
('mapping', identity_fakes.mapping_id)
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.mapping_mock.get.assert_called_with(
|
||||
identity_fakes.mapping_id)
|
||||
|
||||
collist = ('id', 'rules')
|
||||
self.assertEqual(collist, columns)
|
||||
|
||||
datalist = (identity_fakes.mapping_id,
|
||||
identity_fakes.MAPPING_RULES)
|
||||
self.assertEqual(datalist, data)
|
||||
|
||||
|
||||
class TestMappingSet(TestMapping):
|
||||
|
||||
def setUp(self):
|
||||
@ -242,3 +207,38 @@ class TestMappingSet(TestMapping):
|
||||
exceptions.CommandError,
|
||||
self.cmd.take_action,
|
||||
parsed_args)
|
||||
|
||||
|
||||
class TestMappingShow(TestMapping):
|
||||
|
||||
def setUp(self):
|
||||
super(TestMappingShow, self).setUp()
|
||||
|
||||
self.mapping_mock.get.return_value = fakes.FakeResource(
|
||||
None,
|
||||
copy.deepcopy(identity_fakes.MAPPING_RESPONSE),
|
||||
loaded=True
|
||||
)
|
||||
|
||||
self.cmd = mapping.ShowMapping(self.app, None)
|
||||
|
||||
def test_mapping_show(self):
|
||||
arglist = [
|
||||
identity_fakes.mapping_id
|
||||
]
|
||||
verifylist = [
|
||||
('mapping', identity_fakes.mapping_id)
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.mapping_mock.get.assert_called_with(
|
||||
identity_fakes.mapping_id)
|
||||
|
||||
collist = ('id', 'rules')
|
||||
self.assertEqual(collist, columns)
|
||||
|
||||
datalist = (identity_fakes.mapping_id,
|
||||
identity_fakes.MAPPING_RULES)
|
||||
self.assertEqual(datalist, data)
|
||||
|
@ -32,97 +32,6 @@ class TestOAuth1(identity_fakes.TestOAuth1):
|
||||
self.roles_mock.reset_mock()
|
||||
|
||||
|
||||
class TestRequestTokenCreate(TestOAuth1):
|
||||
|
||||
def setUp(self):
|
||||
super(TestRequestTokenCreate, self).setUp()
|
||||
|
||||
self.request_tokens_mock.create.return_value = fakes.FakeResource(
|
||||
None,
|
||||
copy.deepcopy(identity_fakes.OAUTH_REQUEST_TOKEN),
|
||||
loaded=True,
|
||||
)
|
||||
|
||||
self.projects_mock.get.return_value = fakes.FakeResource(
|
||||
None,
|
||||
copy.deepcopy(identity_fakes.PROJECT),
|
||||
loaded=True,
|
||||
)
|
||||
|
||||
self.cmd = token.CreateRequestToken(self.app, None)
|
||||
|
||||
def test_create_request_tokens(self):
|
||||
arglist = [
|
||||
'--consumer-key', identity_fakes.consumer_id,
|
||||
'--consumer-secret', identity_fakes.consumer_secret,
|
||||
'--project', identity_fakes.project_id,
|
||||
]
|
||||
verifylist = [
|
||||
('consumer_key', identity_fakes.consumer_id),
|
||||
('consumer_secret', identity_fakes.consumer_secret),
|
||||
('project', identity_fakes.project_id),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.request_tokens_mock.create.assert_called_with(
|
||||
identity_fakes.consumer_id,
|
||||
identity_fakes.consumer_secret,
|
||||
identity_fakes.project_id,
|
||||
)
|
||||
|
||||
collist = ('expires', 'id', 'key', 'secret')
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = (
|
||||
identity_fakes.request_token_expires,
|
||||
identity_fakes.request_token_id,
|
||||
identity_fakes.request_token_id,
|
||||
identity_fakes.request_token_secret,
|
||||
)
|
||||
self.assertEqual(datalist, data)
|
||||
|
||||
|
||||
class TestRequestTokenAuthorize(TestOAuth1):
|
||||
|
||||
def setUp(self):
|
||||
super(TestRequestTokenAuthorize, self).setUp()
|
||||
|
||||
self.roles_mock.get.return_value = fakes.FakeResource(
|
||||
None,
|
||||
copy.deepcopy(identity_fakes.ROLE),
|
||||
loaded=True,
|
||||
)
|
||||
|
||||
copied_verifier = copy.deepcopy(identity_fakes.OAUTH_VERIFIER)
|
||||
resource = fakes.FakeResource(None, copied_verifier, loaded=True)
|
||||
self.request_tokens_mock.authorize.return_value = resource
|
||||
self.cmd = token.AuthorizeRequestToken(self.app, None)
|
||||
|
||||
def test_authorize_request_tokens(self):
|
||||
arglist = [
|
||||
'--request-key', identity_fakes.request_token_id,
|
||||
'--role', identity_fakes.role_name,
|
||||
]
|
||||
verifylist = [
|
||||
('request_key', identity_fakes.request_token_id),
|
||||
('role', [identity_fakes.role_name]),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.request_tokens_mock.authorize.assert_called_with(
|
||||
identity_fakes.request_token_id,
|
||||
[identity_fakes.role_id],
|
||||
)
|
||||
|
||||
collist = ('oauth_verifier',)
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = (
|
||||
identity_fakes.oauth_verifier_pin,
|
||||
)
|
||||
self.assertEqual(datalist, data)
|
||||
|
||||
|
||||
class TestAccessTokenCreate(TestOAuth1):
|
||||
|
||||
def setUp(self):
|
||||
@ -171,3 +80,94 @@ class TestAccessTokenCreate(TestOAuth1):
|
||||
identity_fakes.access_token_secret,
|
||||
)
|
||||
self.assertEqual(datalist, data)
|
||||
|
||||
|
||||
class TestRequestTokenAuthorize(TestOAuth1):
|
||||
|
||||
def setUp(self):
|
||||
super(TestRequestTokenAuthorize, self).setUp()
|
||||
|
||||
self.roles_mock.get.return_value = fakes.FakeResource(
|
||||
None,
|
||||
copy.deepcopy(identity_fakes.ROLE),
|
||||
loaded=True,
|
||||
)
|
||||
|
||||
copied_verifier = copy.deepcopy(identity_fakes.OAUTH_VERIFIER)
|
||||
resource = fakes.FakeResource(None, copied_verifier, loaded=True)
|
||||
self.request_tokens_mock.authorize.return_value = resource
|
||||
self.cmd = token.AuthorizeRequestToken(self.app, None)
|
||||
|
||||
def test_authorize_request_tokens(self):
|
||||
arglist = [
|
||||
'--request-key', identity_fakes.request_token_id,
|
||||
'--role', identity_fakes.role_name,
|
||||
]
|
||||
verifylist = [
|
||||
('request_key', identity_fakes.request_token_id),
|
||||
('role', [identity_fakes.role_name]),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.request_tokens_mock.authorize.assert_called_with(
|
||||
identity_fakes.request_token_id,
|
||||
[identity_fakes.role_id],
|
||||
)
|
||||
|
||||
collist = ('oauth_verifier',)
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = (
|
||||
identity_fakes.oauth_verifier_pin,
|
||||
)
|
||||
self.assertEqual(datalist, data)
|
||||
|
||||
|
||||
class TestRequestTokenCreate(TestOAuth1):
|
||||
|
||||
def setUp(self):
|
||||
super(TestRequestTokenCreate, self).setUp()
|
||||
|
||||
self.request_tokens_mock.create.return_value = fakes.FakeResource(
|
||||
None,
|
||||
copy.deepcopy(identity_fakes.OAUTH_REQUEST_TOKEN),
|
||||
loaded=True,
|
||||
)
|
||||
|
||||
self.projects_mock.get.return_value = fakes.FakeResource(
|
||||
None,
|
||||
copy.deepcopy(identity_fakes.PROJECT),
|
||||
loaded=True,
|
||||
)
|
||||
|
||||
self.cmd = token.CreateRequestToken(self.app, None)
|
||||
|
||||
def test_create_request_tokens(self):
|
||||
arglist = [
|
||||
'--consumer-key', identity_fakes.consumer_id,
|
||||
'--consumer-secret', identity_fakes.consumer_secret,
|
||||
'--project', identity_fakes.project_id,
|
||||
]
|
||||
verifylist = [
|
||||
('consumer_key', identity_fakes.consumer_id),
|
||||
('consumer_secret', identity_fakes.consumer_secret),
|
||||
('project', identity_fakes.project_id),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.request_tokens_mock.create.assert_called_with(
|
||||
identity_fakes.consumer_id,
|
||||
identity_fakes.consumer_secret,
|
||||
identity_fakes.project_id,
|
||||
)
|
||||
|
||||
collist = ('expires', 'id', 'key', 'secret')
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = (
|
||||
identity_fakes.request_token_expires,
|
||||
identity_fakes.request_token_id,
|
||||
identity_fakes.request_token_id,
|
||||
identity_fakes.request_token_secret,
|
||||
)
|
||||
self.assertEqual(datalist, data)
|
||||
|
@ -241,47 +241,6 @@ class TestServiceProviderList(TestServiceProvider):
|
||||
self.assertEqual(tuple(data), datalist)
|
||||
|
||||
|
||||
class TestServiceProviderShow(TestServiceProvider):
|
||||
|
||||
def setUp(self):
|
||||
super(TestServiceProviderShow, self).setUp()
|
||||
|
||||
ret = fakes.FakeResource(
|
||||
None,
|
||||
copy.deepcopy(service_fakes.SERVICE_PROVIDER),
|
||||
loaded=True,
|
||||
)
|
||||
self.service_providers_mock.get.return_value = ret
|
||||
# Get the command object to test
|
||||
self.cmd = service_provider.ShowServiceProvider(self.app, None)
|
||||
|
||||
def test_service_provider_show(self):
|
||||
arglist = [
|
||||
service_fakes.sp_id,
|
||||
]
|
||||
verifylist = [
|
||||
('service_provider', service_fakes.sp_id),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.service_providers_mock.get.assert_called_with(
|
||||
service_fakes.sp_id,
|
||||
)
|
||||
|
||||
collist = ('auth_url', 'description', 'enabled', 'id', 'sp_url')
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = (
|
||||
service_fakes.sp_auth_url,
|
||||
service_fakes.sp_description,
|
||||
True,
|
||||
service_fakes.sp_id,
|
||||
service_fakes.service_provider_url
|
||||
)
|
||||
self.assertEqual(data, datalist)
|
||||
|
||||
|
||||
class TestServiceProviderSet(TestServiceProvider):
|
||||
|
||||
columns = (
|
||||
@ -420,3 +379,44 @@ class TestServiceProviderSet(TestServiceProvider):
|
||||
# was set.
|
||||
self.assertIsNone(columns)
|
||||
self.assertIsNone(data)
|
||||
|
||||
|
||||
class TestServiceProviderShow(TestServiceProvider):
|
||||
|
||||
def setUp(self):
|
||||
super(TestServiceProviderShow, self).setUp()
|
||||
|
||||
ret = fakes.FakeResource(
|
||||
None,
|
||||
copy.deepcopy(service_fakes.SERVICE_PROVIDER),
|
||||
loaded=True,
|
||||
)
|
||||
self.service_providers_mock.get.return_value = ret
|
||||
# Get the command object to test
|
||||
self.cmd = service_provider.ShowServiceProvider(self.app, None)
|
||||
|
||||
def test_service_provider_show(self):
|
||||
arglist = [
|
||||
service_fakes.sp_id,
|
||||
]
|
||||
verifylist = [
|
||||
('service_provider', service_fakes.sp_id),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.service_providers_mock.get.assert_called_with(
|
||||
service_fakes.sp_id,
|
||||
)
|
||||
|
||||
collist = ('auth_url', 'description', 'enabled', 'id', 'sp_url')
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = (
|
||||
service_fakes.sp_auth_url,
|
||||
service_fakes.sp_description,
|
||||
True,
|
||||
service_fakes.sp_id,
|
||||
service_fakes.service_provider_url
|
||||
)
|
||||
self.assertEqual(data, datalist)
|
||||
|
@ -30,57 +30,6 @@ class TestUnscopedSAML(identity_fakes.TestFederatedIdentity):
|
||||
self.domains_mock.reset_mock()
|
||||
|
||||
|
||||
class TestProjectList(TestUnscopedSAML):
|
||||
|
||||
def setUp(self):
|
||||
super(TestProjectList, self).setUp()
|
||||
|
||||
self.projects_mock.list.return_value = [
|
||||
fakes.FakeResource(
|
||||
None,
|
||||
copy.deepcopy(identity_fakes.PROJECT),
|
||||
loaded=True,
|
||||
),
|
||||
]
|
||||
|
||||
# Get the command object to test
|
||||
self.cmd = unscoped_saml.ListAccessibleProjects(self.app, None)
|
||||
|
||||
def test_accessible_projects_list(self):
|
||||
self.app.client_manager.auth_plugin_name = 'v3unscopedsaml'
|
||||
arglist = []
|
||||
verifylist = []
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
# In base command class Lister in cliff, abstract method take_action()
|
||||
# returns a tuple containing the column names and an iterable
|
||||
# containing the data to be listed.
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.projects_mock.list.assert_called_with()
|
||||
|
||||
collist = ('ID', 'Domain ID', 'Enabled', 'Name')
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = ((
|
||||
identity_fakes.project_id,
|
||||
identity_fakes.domain_id,
|
||||
True,
|
||||
identity_fakes.project_name,
|
||||
), )
|
||||
self.assertEqual(datalist, tuple(data))
|
||||
|
||||
def test_accessible_projects_list_wrong_auth(self):
|
||||
auth = identity_fakes.FakeAuth("wrong auth")
|
||||
self.app.client_manager.identity.session.auth = auth
|
||||
arglist = []
|
||||
verifylist = []
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
self.assertRaises(exceptions.CommandError,
|
||||
self.cmd.take_action,
|
||||
parsed_args)
|
||||
|
||||
|
||||
class TestDomainList(TestUnscopedSAML):
|
||||
|
||||
def setUp(self):
|
||||
@ -130,3 +79,54 @@ class TestDomainList(TestUnscopedSAML):
|
||||
self.assertRaises(exceptions.CommandError,
|
||||
self.cmd.take_action,
|
||||
parsed_args)
|
||||
|
||||
|
||||
class TestProjectList(TestUnscopedSAML):
|
||||
|
||||
def setUp(self):
|
||||
super(TestProjectList, self).setUp()
|
||||
|
||||
self.projects_mock.list.return_value = [
|
||||
fakes.FakeResource(
|
||||
None,
|
||||
copy.deepcopy(identity_fakes.PROJECT),
|
||||
loaded=True,
|
||||
),
|
||||
]
|
||||
|
||||
# Get the command object to test
|
||||
self.cmd = unscoped_saml.ListAccessibleProjects(self.app, None)
|
||||
|
||||
def test_accessible_projects_list(self):
|
||||
self.app.client_manager.auth_plugin_name = 'v3unscopedsaml'
|
||||
arglist = []
|
||||
verifylist = []
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
# In base command class Lister in cliff, abstract method take_action()
|
||||
# returns a tuple containing the column names and an iterable
|
||||
# containing the data to be listed.
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.projects_mock.list.assert_called_with()
|
||||
|
||||
collist = ('ID', 'Domain ID', 'Enabled', 'Name')
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = ((
|
||||
identity_fakes.project_id,
|
||||
identity_fakes.domain_id,
|
||||
True,
|
||||
identity_fakes.project_name,
|
||||
), )
|
||||
self.assertEqual(datalist, tuple(data))
|
||||
|
||||
def test_accessible_projects_list_wrong_auth(self):
|
||||
auth = identity_fakes.FakeAuth("wrong auth")
|
||||
self.app.client_manager.identity.session.auth = auth
|
||||
arglist = []
|
||||
verifylist = []
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
self.assertRaises(exceptions.CommandError,
|
||||
self.cmd.take_action,
|
||||
parsed_args)
|
||||
|
Loading…
Reference in New Issue
Block a user