diff --git a/pagure/api/__init__.py b/pagure/api/__init__.py index af5de20..394a33e 100644 --- a/pagure/api/__init__.py +++ b/pagure/api/__init__.py @@ -261,6 +261,7 @@ if pagure_config.get('PAGURE_CI_SERVICES', False): @API.route('/version/') @API.route('/version') +@API.route('/-/version') def api_version(): ''' API Version @@ -269,7 +270,7 @@ def api_version(): :: - GET /api/0/version + GET /api/0/-/version Sample response ^^^^^^^^^^^^^^^ @@ -457,6 +458,7 @@ def api_project_tags(repo, username=None): @API.route('/error_codes/') @API.route('/error_codes') +@API.route('/-/error_codes') def api_error_codes(): ''' Error codes @@ -465,7 +467,7 @@ def api_error_codes(): :: - GET /api/0/error_codes + GET /api/0/-/error_codes Sample response ^^^^^^^^^^^^^^^ diff --git a/tests/test_pagure_flask_api.py b/tests/test_pagure_flask_api.py index 4a9e9fc..dc54ce5 100644 --- a/tests/test_pagure_flask_api.py +++ b/tests/test_pagure_flask_api.py @@ -45,15 +45,22 @@ class PagureFlaskApitests(tests.SimplePagureTest): content_type='application/json'): self.assertEqual(pagure.api.get_request_data()['foo'], 'bar') - def test_api_version(self): + def test_api_version_old_url(self): """ Test the api_version function. """ - output = self.app.get('/api/0/version') self.assertEqual(output.status_code, 200) data = json.loads(output.get_data(as_text=True)) self.assertEqual(data['version'], pagure.__api_version__) self.assertEqual(sorted(data.keys()), ['version']) + def test_api_version_new_url(self): + """ Test the api_version function at its new url. """ + output = self.app.get('/api/0/-/version') + self.assertEqual(output.status_code, 200) + data = json.loads(output.get_data(as_text=True)) + self.assertEqual(data['version'], pagure.__api_version__) + self.assertEqual(sorted(data.keys()), ['version']) + def test_api_project_tags(self): """ Test the api_project_tags function. """ tests.create_projects(self.session)