From e72072adc3b62b5ef8e3076169fed19dea9995f7 Mon Sep 17 00:00:00 2001 From: Terry Howe Date: Mon, 31 Mar 2014 14:48:42 -0600 Subject: Fix the project option to user list so it filters The --project option to the user list command was not implemented * Allow users to be filted by project * Support id or name of project with the find_resource command * Make sure the report does not contain duplicates Change-Id: Ic0e10cccd7749d38a7d4b80bbdc68e61a660084b Closes-Bug: #1177255 --- openstackclient/tests/identity/v2_0/test_user.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'openstackclient/tests') diff --git a/openstackclient/tests/identity/v2_0/test_user.py b/openstackclient/tests/identity/v2_0/test_user.py index dfb358ff..e191431c 100644 --- a/openstackclient/tests/identity/v2_0/test_user.py +++ b/openstackclient/tests/identity/v2_0/test_user.py @@ -381,6 +381,11 @@ class TestUserList(TestUser): def setUp(self): super(TestUserList, self).setUp() + self.projects_mock.get.return_value = fakes.FakeResource( + None, + copy.deepcopy(identity_fakes.PROJECT_2), + loaded=True, + ) self.projects_mock.list.return_value = [ fakes.FakeResource( None, @@ -408,7 +413,7 @@ class TestUserList(TestUser): # DisplayCommandBase.take_action() returns two tuples columns, data = self.cmd.take_action(parsed_args) - self.users_mock.list.assert_called_with() + self.users_mock.list.assert_called_with(tenant_id=None) collist = ('ID', 'Name') self.assertEqual(columns, collist) @@ -426,11 +431,12 @@ class TestUserList(TestUser): ('project', identity_fakes.project_id), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) + project_id = identity_fakes.PROJECT_2['id'] # DisplayCommandBase.take_action() returns two tuples columns, data = self.cmd.take_action(parsed_args) - self.users_mock.list.assert_called_with() + self.users_mock.list.assert_called_with(tenant_id=project_id) collist = ('ID', 'Name') self.assertEqual(columns, collist) @@ -452,7 +458,7 @@ class TestUserList(TestUser): # DisplayCommandBase.take_action() returns two tuples columns, data = self.cmd.take_action(parsed_args) - self.users_mock.list.assert_called_with() + self.users_mock.list.assert_called_with(tenant_id=None) collist = ('ID', 'Name', 'Project', 'Email', 'Enabled') self.assertEqual(columns, collist) -- cgit v1.2.1