1
# Copyright 2012 OpenStack LLC.
4
# Licensed under the Apache License, Version 2.0 (the "License"); you may
5
# not use this file except in compliance with the License. You may obtain
6
# a copy of the License at
8
# http://www.apache.org/licenses/LICENSE-2.0
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
# License for the specific language governing permissions and limitations
16
from ceilometerclient.tests import utils
17
import ceilometerclient.v1.meters
30
'/v1/sources/source_b/users': {
39
class UserManagerTest(utils.BaseTestCase):
42
super(UserManagerTest, self).setUp()
43
self.api = utils.FakeAPI(fixtures)
44
self.mgr = ceilometerclient.v1.meters.UserManager(self.api)
46
def test_list_all(self):
47
users = list(self.mgr.list())
49
('GET', '/v1/users', {}, None),
51
self.assertEqual(self.api.calls, expect)
52
self.assertEqual(len(users), 2)
53
self.assertEqual(users[0].user_id, 'a')
54
self.assertEqual(users[1].user_id, 'b')
56
def test_list_by_source(self):
57
users = list(self.mgr.list(source='source_b'))
59
('GET', '/v1/sources/source_b/users', {}, None),
61
self.assertEqual(self.api.calls, expect)
62
self.assertEqual(len(users), 1)
63
self.assertEqual(users[0].user_id, 'b')