Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

Commit

Permalink
fix return value in testing stub for creating activities (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
anneFly committed Feb 6, 2019
1 parent 1be6b3d commit 9094a97
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
2 changes: 2 additions & 0 deletions closeio/contrib/testing_stub.py
Expand Up @@ -340,6 +340,7 @@ def create_activity_call(self, **kwargs):
calls[lead_id] = []

calls[lead_id].append(call)
return call

@parse_response
def create_activity_note(self, **kwargs):
Expand All @@ -352,6 +353,7 @@ def create_activity_note(self, **kwargs):
notes[lead_id] = []

notes[lead_id].append(note)
return note

@parse_response
def delete_activity_email(self, activity_id):
Expand Down
46 changes: 45 additions & 1 deletion tests/test_testing_stub.py
Expand Up @@ -3,7 +3,7 @@
from closeio.contrib.testing_stub import CloseIOStub


class TestCloseIOStub:
class TestEventLogs:
def test_record_and_retrieve_event_logs(self):
client = CloseIOStub()

Expand Down Expand Up @@ -47,3 +47,47 @@ def test_record_and_retrieve_event_logs(self):
assert len(logs) == 2
assert logs[0]['object_id'] == task3['id']
assert logs[1]['object_id'] == task3['id']


class TestCreateActivities:
def test_create_activity_note(self):
client = CloseIOStub()

kwargs = {
'note': 'this is a test note.',
'lead_id': 'lead_s6vHFTK1TSRoH6otXOexWDO9jM4xyb1kELHDoU7Fdsp',
}
response = client.create_activity_note(**kwargs)
assert response['id'].startswith('acti_')

def test_create_activity_call(self):
client = CloseIOStub()

kwargs = {
'direction': 'outbound',
'status': 'completed',
'note': 'call notes go here',
'duration': 153,
'lead_id': 'lead_s6vHFTK1TSRoH6otXOexWDO9jM4xyb1kELHDoU7Fdsp',
}
response = client.create_activity_call(**kwargs)
assert response['id'].startswith('acti_')

def test_create_activity_email(self):
client = CloseIOStub()

kwargs = {
'subject': 'test subject',
'sender': 'sender@example.com',
'to': ['recipient+1@example.com'],
'bcc': [],
'cc': [],
'status': 'draft',
'body_text': 'test',
'body_html': 'test',
'attachments': [],
'template_id': None,
'lead_id': 'lead_s6vHFTK1TSRoH6otXOexWDO9jM4xyb1kELHDoU7Fdsp',
}
response = client.create_activity_email(**kwargs)
assert response['id'].startswith('acti_')

0 comments on commit 9094a97

Please sign in to comment.