diff --git a/shipyard_client/api_client/shipyard_api_client.py b/shipyard_client/api_client/shipyard_api_client.py index a56596c5..3cf8af50 100644 --- a/shipyard_client/api_client/shipyard_api_client.py +++ b/shipyard_client/api_client/shipyard_api_client.py @@ -25,6 +25,7 @@ class ApiPaths(enum.Enum): includes api/v1.0, so it is not repeated here. """ _BASE_URL = '{}/' + GET_CONFIGDOCS = _BASE_URL + 'configdocs' POST_GET_CONFIG = _BASE_URL + 'configdocs/{}' GET_RENDERED = _BASE_URL + 'renderedconfigdocs' COMMIT_CONFIG = _BASE_URL + 'commitconfigdocs' @@ -79,6 +80,14 @@ class ShipyardClient(BaseClient): collection_id) return self.get_resp(url, query_params) + def get_configdocs_status(self): + """ + Get the status of the collection of documents from shipyard + :returns: Response object + """ + url = ApiPaths.GET_CONFIGDOCS.value.format(self.get_endpoint()) + return self.get_resp(url) + def get_rendereddocs(self, version='buffer'): """ :param str version: committed|buffer diff --git a/shipyard_client/tests/unit/apiclient_test/test_shipyard_api_client.py b/shipyard_client/tests/unit/apiclient_test/test_shipyard_api_client.py index 7e596d2d..3f41cf8c 100644 --- a/shipyard_client/tests/unit/apiclient_test/test_shipyard_api_client.py +++ b/shipyard_client/tests/unit/apiclient_test/test_shipyard_api_client.py @@ -58,8 +58,7 @@ def get_api_client(): context = ShipyardClientContext( debug=True, keystone_auth=keystone_auth, - context_marker='88888888-4444-4444-4444-121212121212' - ) + context_marker='88888888-4444-4444-4444-121212121212') return ShipyardClient(context) @@ -89,6 +88,16 @@ def test_get_config_docs(*args): assert params['version'] == version +@mock.patch.object(BaseClient, 'post_resp', replace_post_rep) +@mock.patch.object(BaseClient, 'get_resp', replace_get_resp) +@mock.patch.object(BaseClient, 'get_endpoint', replace_get_endpoint) +def test_get_configdocs_status(*args): + shipyard_client = get_api_client() + result = shipyard_client.get_configdocs_status() + assert result['url'] == '{}/configdocs'.format( + shipyard_client.get_endpoint()) + + @mock.patch.object(BaseClient, 'post_resp', replace_post_rep) @mock.patch.object(BaseClient, 'get_resp', replace_get_resp) @mock.patch.object(BaseClient, 'get_endpoint', replace_get_endpoint) @@ -121,9 +130,7 @@ def test_commit_configs(*args): def test_get_actions(*args): shipyard_client = get_api_client() result = shipyard_client.get_actions() - assert result['url'] == '{}/actions'.format( - shipyard_client.get_endpoint() - ) + assert result['url'] == '{}/actions'.format(shipyard_client.get_endpoint()) @mock.patch.object(BaseClient, 'post_resp', replace_post_rep) @@ -135,9 +142,7 @@ def test_post_actions(*args): parameters = {'hello': 'world'} result = shipyard_client.post_actions(name, parameters) data = json.loads(result['data']) - assert result['url'] == '{}/actions'.format( - shipyard_client.get_endpoint() - ) + assert result['url'] == '{}/actions'.format(shipyard_client.get_endpoint()) assert data['name'] == name assert data['parameters']['hello'] == 'world'