diff --git a/ceilometer/api/v1.py b/ceilometer/api/v1.py index bb9b2212..305f718c 100644 --- a/ceilometer/api/v1.py +++ b/ceilometer/api/v1.py @@ -56,12 +56,12 @@ def list_users(source): @blueprint.route('/users/') @blueprint.route('/users//meters/') @blueprint.route('/users//resources/') -@blueprint.route('/users//resources//meter/') +@blueprint.route('/users//resources//meters/') @blueprint.route('/sources//users/') @blueprint.route('/sources//users//meters/') @blueprint.route('/sources//users//resources/') @blueprint.route( - '/sources//users//resources//meter/' + '/sources//users//resources//meters/' ) def list_events(user, meter=None, resource=None, source=None): f = storage.EventFilter(user=user, diff --git a/tests/api/v1/test_list_events.py b/tests/api/v1/test_list_events.py index 31fd3929..74bbd7af 100644 --- a/tests/api/v1/test_list_events.py +++ b/tests/api/v1/test_list_events.py @@ -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']]