Skip to content

Commit

Permalink
allow sending params in transmission list endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
rajumsys committed Mar 2, 2017
1 parent 8808080 commit 693d568
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sparkpost/transmissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,17 @@ def get(self, transmission_id):
results = self._fetch_get(transmission_id)
return results['transmission']

def list(self):
def list(self, **kwargs):
"""
Get a list of your transmissions
:param campaign_id: ID of the campaign used by the transmissions
:param template_id: ID of the template used by the transmissions
:returns: list of transmissions
:raises: :exc:`SparkPostAPIException` if API call fails
"""
results = self.request('GET', self.uri)
return results
return self.request('GET', self.uri, params=kwargs)

def delete(self, transmission_id):
"""
Expand Down
16 changes: 16 additions & 0 deletions test/test_transmissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,22 @@ def test_success_list():
assert response == []


@responses.activate
def test_success_list_with_params():
responses.add(
responses.GET,
'https://api.sparkpost.com/api/v1/transmissions?template_id=abcd',
status=200,
content_type='application/json',
body='{"results": []}',
match_querystring=True

)
sp = SparkPost('fake-key')
response = sp.transmission.list(template_id='abcd')
assert response == []


@responses.activate
def test_success_delete():
responses.add(
Expand Down

0 comments on commit 693d568

Please sign in to comment.