forked from Vonage/vonage-python-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_applications.py
More file actions
58 lines (41 loc) · 2 KB
/
Copy pathtest_applications.py
File metadata and controls
58 lines (41 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from util import *
@responses.activate
def test_get_applications(client, dummy_data):
stub(responses.GET, "https://api.nexmo.com/v1/applications")
with pytest.warns(DeprecationWarning) as warning_info:
assert isinstance(client.get_applications(), dict)
assert request_user_agent() == dummy_data.user_agent
@responses.activate
def test_get_application(client, dummy_data):
stub(responses.GET, "https://api.nexmo.com/v1/applications/xx-xx-xx-xx")
with pytest.warns(DeprecationWarning) as warning_info:
assert isinstance(client.get_application("xx-xx-xx-xx"), dict)
assert request_user_agent() == dummy_data.user_agent
@responses.activate
def test_create_application(client, dummy_data):
stub(responses.POST, "https://api.nexmo.com/v1/applications")
params = {"name": "Example App", "type": "voice"}
with pytest.warns(DeprecationWarning) as warning_info:
assert isinstance(client.create_application(params), dict)
assert request_user_agent() == dummy_data.user_agent
assert "name=Example+App" in request_body()
assert "type=voice" in request_body()
@responses.activate
def test_update_application(client, dummy_data):
stub(responses.PUT, "https://api.nexmo.com/v1/applications/xx-xx-xx-xx")
params = {"answer_url": "https://example.com/ncco"}
with pytest.warns(DeprecationWarning) as warning_info:
assert isinstance(client.update_application("xx-xx-xx-xx", params), dict)
assert request_user_agent() == dummy_data.user_agent
assert request_content_type() == "application/json"
assert b'"answer_url": "https://example.com/ncco"' in request_body()
@responses.activate
def test_delete_application(client, dummy_data):
responses.add(
responses.DELETE,
"https://api.nexmo.com/v1/applications/xx-xx-xx-xx",
status=204,
)
with pytest.warns(DeprecationWarning) as warning_info:
assert client.delete_application("xx-xx-xx-xx") is None
assert request_user_agent() == dummy_data.user_agent