Merge "Allow endpoint filtering on both project and project-domain"
This commit is contained in:
commit
c19aee4c70
@ -199,7 +199,7 @@ class ListEndpoint(command.Lister):
|
|||||||
metavar='<project>',
|
metavar='<project>',
|
||||||
help=_('Project to list filters (name or ID)'),
|
help=_('Project to list filters (name or ID)'),
|
||||||
)
|
)
|
||||||
common.add_project_domain_option_to_parser(list_group)
|
common.add_project_domain_option_to_parser(parser)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
|
@ -439,6 +439,47 @@ class TestEndpointList(TestEndpoint):
|
|||||||
)
|
)
|
||||||
self.assertEqual(datalist, tuple(data))
|
self.assertEqual(datalist, tuple(data))
|
||||||
|
|
||||||
|
def test_endpoint_list_project_with_project_domain(self):
|
||||||
|
project = identity_fakes.FakeProject.create_one_project()
|
||||||
|
domain = identity_fakes.FakeDomain.create_one_domain()
|
||||||
|
|
||||||
|
self.ep_filter_mock.list_endpoints_for_project.return_value = [
|
||||||
|
self.endpoint
|
||||||
|
]
|
||||||
|
self.projects_mock.get.return_value = project
|
||||||
|
|
||||||
|
arglist = [
|
||||||
|
'--project', project.name,
|
||||||
|
'--project-domain', domain.name
|
||||||
|
]
|
||||||
|
verifylist = [
|
||||||
|
('project', project.name),
|
||||||
|
('project_domain', domain.name),
|
||||||
|
]
|
||||||
|
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.ep_filter_mock.list_endpoints_for_project.assert_called_with(
|
||||||
|
project=project.id
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(self.columns, columns)
|
||||||
|
datalist = (
|
||||||
|
(
|
||||||
|
self.endpoint.id,
|
||||||
|
self.endpoint.region,
|
||||||
|
self.service.name,
|
||||||
|
self.service.type,
|
||||||
|
True,
|
||||||
|
self.endpoint.interface,
|
||||||
|
self.endpoint.url,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
self.assertEqual(datalist, tuple(data))
|
||||||
|
|
||||||
|
|
||||||
class TestEndpointSet(TestEndpoint):
|
class TestEndpointSet(TestEndpoint):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user