Fix "meter" literal in event list API
Change-Id: I55dd108bab9a5aed9730d2c81ecab3a4ed909189 Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
This commit is contained in:
parent
e24300b799
commit
1c92548c5a
@ -56,12 +56,12 @@ def list_users(source):
|
||||
@blueprint.route('/users/<user>')
|
||||
@blueprint.route('/users/<user>/meters/<meter>')
|
||||
@blueprint.route('/users/<user>/resources/<resource>')
|
||||
@blueprint.route('/users/<user>/resources/<resource>/meter/<meter>')
|
||||
@blueprint.route('/users/<user>/resources/<resource>/meters/<meter>')
|
||||
@blueprint.route('/sources/<source>/users/<user>')
|
||||
@blueprint.route('/sources/<source>/users/<user>/meters/<meter>')
|
||||
@blueprint.route('/sources/<source>/users/<user>/resources/<resource>')
|
||||
@blueprint.route(
|
||||
'/sources/<source>/users/<user>/resources/<resource>/meter/<meter>'
|
||||
'/sources/<source>/users/<user>/resources/<resource>/meters/<meter>'
|
||||
)
|
||||
def list_events(user, meter=None, resource=None, source=None):
|
||||
f = storage.EventFilter(user=user,
|
||||
|
@ -75,6 +75,14 @@ class TestListEvents(tests_api.TestBase):
|
||||
data = self.get('/users/user-id')
|
||||
self.assertEquals(2, len(data['events']))
|
||||
|
||||
def test_with_user_and_meters(self):
|
||||
data = self.get('/users/user-id/meters/instance')
|
||||
self.assertEquals(2, len(data['events']))
|
||||
|
||||
def test_with_user_and_meters_invalid(self):
|
||||
data = self.get('/users/user-id/meters/no-such-meter')
|
||||
self.assertEquals(0, len(data['events']))
|
||||
|
||||
def test_with_source_and_user(self):
|
||||
data = self.get('/sources/source1/users/user-id')
|
||||
ids = [r['resource_id'] for r in data['events']]
|
||||
|
Loading…
Reference in New Issue
Block a user