-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
154 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
Dan Pozmanter | ||
Garry Shutler <[email protected]> | ||
Stephen Binns <[email protected]> | ||
Chris Nevett <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -600,6 +600,135 @@ def request_callback(request): | |
assert result['attachments']['icalendar'] == "BEGIN:VCALENDAR\nVERSION:2.0..." | ||
|
||
|
||
@responses.activate | ||
def test_cancel_smart_invite(client): | ||
smart_invite_id = "qTtZdczOccgaPncGJaCiLg" | ||
recipient = { | ||
'email': "[email protected]" | ||
} | ||
|
||
def request_callback(request): | ||
assert request.url == 'https://api.cronofy.com/v1/smart_invites' | ||
|
||
payload = json.loads(request.body) | ||
assert payload['method'] == 'cancel' | ||
assert payload['recipient'] == recipient | ||
assert payload['smart_invite_id'] == smart_invite_id | ||
|
||
response = { | ||
"recipient": { | ||
"email": "[email protected]", | ||
"status": "pending" | ||
}, | ||
"smart_invite_id": "qTtZdczOccgaPncGJaCiLg", | ||
"callback_url": "https://example.yourapp.com/cronofy/smart_invite/notifications", | ||
"event": { | ||
"summary": "Board meeting", | ||
"description": "Discuss plans for the next quarter.", | ||
"start": "2017-10-05T09:30:00Z", | ||
"end": "2017-10-05T10:00:00Z", | ||
"tzid": "Europe/London", | ||
"location": { | ||
"description": "Board room" | ||
} | ||
}, | ||
"attachments": { | ||
"icalendar": "BEGIN:VCALENDAR\nVERSION:2.0..." | ||
} | ||
} | ||
|
||
return (202, {}, json.dumps(response)) | ||
|
||
responses.add_callback( | ||
responses.POST, | ||
'%s/v1/smart_invites' % settings.API_BASE_URL, | ||
callback=request_callback, | ||
content_type='application/json', | ||
) | ||
|
||
result = client.cancel_smart_invite(smart_invite_id, recipient) | ||
|
||
assert result['attachments']['icalendar'] == "BEGIN:VCALENDAR\nVERSION:2.0..." | ||
|
||
|
||
@responses.activate | ||
def test_cancel_smart_invite_with_multiple_recipients(client): | ||
smart_invite_id = "qTtZdczOccgaPncGJaCiLg" | ||
recipients = [ | ||
{ | ||
'email': "[email protected]" | ||
}, | ||
{ | ||
'email': "[email protected]" | ||
}, | ||
] | ||
|
||
def request_callback(request): | ||
assert request.url == 'https://api.cronofy.com/v1/smart_invites' | ||
|
||
payload = json.loads(request.body) | ||
assert payload['method'] == 'cancel' | ||
assert payload['recipients'] == recipients | ||
assert payload['smart_invite_id'] == smart_invite_id | ||
|
||
response = { | ||
"recipients": [ | ||
{ | ||
"email": "[email protected]", | ||
"status": "tentative", | ||
"comment": "example comment", | ||
"proposal": { | ||
"start": { | ||
"time": "2014-09-13T23:00:00+02:00", | ||
"tzid": "Europe/Paris" | ||
}, | ||
"end": { | ||
"time": "2014-09-13T23:00:00+02:00", | ||
"tzid": "Europe/Paris" | ||
} | ||
} | ||
}, | ||
{ | ||
"email": "[email protected]", | ||
"status": "pending" | ||
} | ||
], | ||
"smart_invite_id": "qTtZdczOccgaPncGJaCiLg", | ||
"callback_url": "https://example.yourapp.com/cronofy/smart_invite/notifications", | ||
"event": { | ||
"summary": "Board meeting", | ||
"description": "Discuss plans for the next quarter.", | ||
"start": { | ||
"time": "2020-08-07T09:30:00Z", | ||
"tzid": "Europe/London" | ||
}, | ||
"end": { | ||
"time": "2020-08-07T10:00:00Z", | ||
"tzid": "Europe/London" | ||
}, | ||
"location": { | ||
"description": "Board room" | ||
} | ||
}, | ||
"attachments": { | ||
"icalendar": "BEGIN:VCALENDAR\nVERSION:2.0..." | ||
} | ||
} | ||
|
||
return (202, {}, json.dumps(response)) | ||
|
||
responses.add_callback( | ||
responses.POST, | ||
'%s/v1/smart_invites' % settings.API_BASE_URL, | ||
callback=request_callback, | ||
content_type='application/json', | ||
) | ||
|
||
result = client.cancel_smart_invite(smart_invite_id, recipients) | ||
|
||
assert result['attachments']['icalendar'] == "BEGIN:VCALENDAR\nVERSION:2.0..." | ||
|
||
|
||
@responses.activate | ||
def test_user_auth_link(client): | ||
"""Test user auth link returns a properly formatted user auth url. | ||
|