From 0e11ec52e7f2fc4a14d67ec76e1044963ea97b44 Mon Sep 17 00:00:00 2001 From: Amelia Cordwell Date: Wed, 5 Jul 2017 13:39:22 +1200 Subject: [PATCH] Remove dates from QuotationManger list Quotations are always returned for the current month, distil doesn't take request parameters into account for it. This changes the manager to adhere to that. Change-Id: I2bbc6e1033e97370c88396c42d92fbd828592eed --- distilclient/tests/unit/v2/test_quotations.py | 11 ++++------- distilclient/v2/quotations.py | 11 +++-------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/distilclient/tests/unit/v2/test_quotations.py b/distilclient/tests/unit/v2/test_quotations.py index c907868..dc51d60 100644 --- a/distilclient/tests/unit/v2/test_quotations.py +++ b/distilclient/tests/unit/v2/test_quotations.py @@ -33,14 +33,11 @@ class QuotationsTest(utils.TestCase): @mock.patch.object(base.Manager, '_list') def test_list_with_project_id(self, mock_list): - self.client.quotations.list('2017-1-1', '2018-2-1', - 'project_id') - mock_list.assert_called_with('/v2/quotations?start=2017-1-1' - '&end=2018-2-1&project_id=project_id', + self.client.quotations.list('project_id') + mock_list.assert_called_with('/v2/quotations?project_id=project_id', 'quotations') @mock.patch.object(base.Manager, '_list') def test_list_without_project_id(self, mock_list): - self.client.quotations.list('2017-1-1', '2018-2-1') - mock_list.assert_called_with('/v2/quotations?start=2017-1-1' - '&end=2018-2-1', 'quotations') + self.client.quotations.list() + mock_list.assert_called_with('/v2/quotations', 'quotations') diff --git a/distilclient/v2/quotations.py b/distilclient/v2/quotations.py index 7a0e60b..36a32b3 100644 --- a/distilclient/v2/quotations.py +++ b/distilclient/v2/quotations.py @@ -17,20 +17,15 @@ from distilclient import base class QuotationManager(base.Manager): - def list(self, start, end, project_id=None): + def list(self, project_id=None): """Retrieve a list of quotations. - :param start: Start date of the query - :param end: End date of the query :param project_id: Project ID, there there is no project id given, Distil will use the project ID from token. :returns: A list of quotations. """ - url = "/v2/quotations?start={0}&end={1}" + url = "/v2/quotations" if project_id: - url = url.format(start, end) + "&project_id=" + project_id - else: - url = url.format(start, end) - + url = url + "?project_id=" + project_id return self._list(url, "quotations")