From 260da3cd8c6af782fd91396fb7f2e6abecf44428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20HUBSCHER?= Date: Mon, 2 Nov 2015 16:53:32 +0100 Subject: [PATCH] @leplatrem review. --- CHANGELOG.rst | 2 +- cliquet/__init__.py | 2 +- cliquet/tests/test_views_hello.py | 2 +- cliquet/views/hello.py | 2 +- cliquet_docs/api/utilities.rst | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0e43e07b..c99fdd32 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,7 +9,7 @@ This document describes changes between each past release. **Protocol** -- Add the ``api_version`` to tell which protocol version is +- Add the ``protocol`` to tell which protocol version is implemented by the service. (#324) diff --git a/cliquet/__init__.py b/cliquet/__init__.py index 159dbbe1..e29f381e 100644 --- a/cliquet/__init__.py +++ b/cliquet/__init__.py @@ -21,7 +21,7 @@ __version__ = pkg_resources.get_distribution(__package__).version # The API version is derivated from the module version. -API_VERSION = '%s' % __version__.split('.')[0] +API_VERSION = 'v%s' % __version__.split('.')[0] DEFAULT_SETTINGS = { diff --git a/cliquet/tests/test_views_hello.py b/cliquet/tests/test_views_hello.py index a22b84ff..7938c20a 100644 --- a/cliquet/tests/test_views_hello.py +++ b/cliquet/tests/test_views_hello.py @@ -8,7 +8,7 @@ class HelloViewTest(BaseWebTest, unittest.TestCase): def test_returns_info_about_url_and_version(self): response = self.app.get('/') self.assertEqual(response.json['version'], "0.0.1") - self.assertEqual(response.json['api_version'], "2") + self.assertEqual(response.json['protocol'], "v2") self.assertEqual(response.json['url'], 'http://localhost/v0/') self.assertEqual(response.json['hello'], 'myapp') self.assertEqual(response.json['documentation'], diff --git a/cliquet/views/hello.py b/cliquet/views/hello.py index 6a7bc788..1389f36e 100644 --- a/cliquet/views/hello.py +++ b/cliquet/views/hello.py @@ -13,7 +13,7 @@ def get_hello(request): data = dict( hello=project_name, version=settings['project_version'], - api_version=API_VERSION, + protocol=API_VERSION, url=request.route_url(hello.name), documentation=settings['project_docs'] ) diff --git a/cliquet_docs/api/utilities.rst b/cliquet_docs/api/utilities.rst index 0bdebfb7..55a5548e 100644 --- a/cliquet_docs/api/utilities.rst +++ b/cliquet_docs/api/utilities.rst @@ -9,7 +9,7 @@ GET / The returned value is a JSON mapping containing: - ``hello``: the name of the service (e.g. ``"reading list"``) -- ``api_version``: the cliquet protocol version (``"2"``) +- ``protocol``: the cliquet protocol version (``"v2"``) - ``version``: complete version (``"X.Y.Z"``) - ``url``: absolute URI (without a trailing slash) of the API (*can be used by client to build URIs*) - ``eos``: date of end of support in ISO 8601 format (``"yyyy-mm-dd"``, undefined if unknown)