summaryrefslogtreecommitdiff
path: root/openstackclient/tests
diff options
context:
space:
mode:
authorTerry Howe <terrylhowe@gmail.com>2014-03-31 14:48:42 -0600
committerTerry Howe <terrylhowe@gmail.com>2014-04-01 09:03:45 -0600
commite72072adc3b62b5ef8e3076169fed19dea9995f7 (patch)
treeb953248f2c9a94085a0e2b9dd9ebe5471d455dc4 /openstackclient/tests
parentee22070473dab8bfa3e89d47f1f5a77918c2b026 (diff)
downloadpython-openstackclient-e72072adc3b62b5ef8e3076169fed19dea9995f7.tar.gz
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
Diffstat (limited to 'openstackclient/tests')
-rw-r--r--openstackclient/tests/identity/v2_0/test_user.py12
1 files changed, 9 insertions, 3 deletions
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)