-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_sync_contacts.py
More file actions
64 lines (38 loc) · 1.59 KB
/
test_sync_contacts.py
File metadata and controls
64 lines (38 loc) · 1.59 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
59
60
61
62
63
64
import pytest
from mpt_api_client import RQLQuery
from mpt_api_client.exceptions import MPTAPIError
pytestmark = [pytest.mark.flaky]
def test_created_contact(created_contact): # noqa: AAA01
assert created_contact is not None
def test_get_contact(mpt_ops, created_contact_id):
service = mpt_ops.notifications.contacts
result = service.get(created_contact_id)
assert result.id == created_contact_id
def test_list_contacts(mpt_ops, created_contact_id):
iterator = mpt_ops.notifications.contacts.filter(RQLQuery(id=created_contact_id)).iterate()
result = list(iterator)
assert len(result) == 1
assert result[0].id == created_contact_id
def test_get_contact_not_found(mpt_ops, invalid_contact_id):
service = mpt_ops.notifications.contacts
with pytest.raises(MPTAPIError):
service.get(invalid_contact_id)
def test_block_unblock_contact(mpt_ops, created_contact): # noqa: AAA01
service = mpt_ops.notifications.contacts
result_block = service.block(created_contact.id)
result_unblock = service.unblock(created_contact.id)
assert result_block.status == "Blocked"
assert result_unblock.status == "Active"
def test_update_contact(mpt_ops, created_contact, short_uuid):
service = mpt_ops.notifications.contacts
new_name = f"delete {short_uuid}"
result = service.update(
created_contact.id,
{
"name": new_name,
},
)
assert result.name == new_name
def test_delete_contact(mpt_ops, created_contact_id):
service = mpt_ops.notifications.contacts
service.delete(created_contact_id) # act