Merge "Remove dates from QuotationManger list"
This commit is contained in:
commit
cd73c9ad94
|
@ -33,14 +33,11 @@ class QuotationsTest(utils.TestCase):
|
||||||
|
|
||||||
@mock.patch.object(base.Manager, '_list')
|
@mock.patch.object(base.Manager, '_list')
|
||||||
def test_list_with_project_id(self, mock_list):
|
def test_list_with_project_id(self, mock_list):
|
||||||
self.client.quotations.list('2017-1-1', '2018-2-1',
|
self.client.quotations.list('project_id')
|
||||||
'project_id')
|
mock_list.assert_called_with('/v2/quotations?project_id=project_id',
|
||||||
mock_list.assert_called_with('/v2/quotations?start=2017-1-1'
|
|
||||||
'&end=2018-2-1&project_id=project_id',
|
|
||||||
'quotations')
|
'quotations')
|
||||||
|
|
||||||
@mock.patch.object(base.Manager, '_list')
|
@mock.patch.object(base.Manager, '_list')
|
||||||
def test_list_without_project_id(self, mock_list):
|
def test_list_without_project_id(self, mock_list):
|
||||||
self.client.quotations.list('2017-1-1', '2018-2-1')
|
self.client.quotations.list()
|
||||||
mock_list.assert_called_with('/v2/quotations?start=2017-1-1'
|
mock_list.assert_called_with('/v2/quotations', 'quotations')
|
||||||
'&end=2018-2-1', 'quotations')
|
|
||||||
|
|
|
@ -17,20 +17,15 @@ from distilclient import base
|
||||||
|
|
||||||
class QuotationManager(base.Manager):
|
class QuotationManager(base.Manager):
|
||||||
|
|
||||||
def list(self, start, end, project_id=None):
|
def list(self, project_id=None):
|
||||||
"""Retrieve a list of quotations.
|
"""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,
|
:param project_id: Project ID, there there is no project id given,
|
||||||
Distil will use the project ID from token.
|
Distil will use the project ID from token.
|
||||||
:returns: A list of quotations.
|
:returns: A list of quotations.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
url = "/v2/quotations?start={0}&end={1}"
|
url = "/v2/quotations"
|
||||||
if project_id:
|
if project_id:
|
||||||
url = url.format(start, end) + "&project_id=" + project_id
|
url = url + "?project_id=" + project_id
|
||||||
else:
|
|
||||||
url = url.format(start, end)
|
|
||||||
|
|
||||||
return self._list(url, "quotations")
|
return self._list(url, "quotations")
|
||||||
|
|
Loading…
Reference in New Issue