-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_channel_messages.py
More file actions
66 lines (43 loc) · 1.93 KB
/
test_channel_messages.py
File metadata and controls
66 lines (43 loc) · 1.93 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
65
66
import pytest
from mpt_api_client.resources.helpdesk.channel_messages import (
AsyncChannelMessagesService,
ChannelMessagesService,
)
@pytest.fixture
def channel_messages_service(http_client) -> ChannelMessagesService:
return ChannelMessagesService(
http_client=http_client, endpoint_params={"channel_id": "CHN-0000-0000-0001"}
)
@pytest.fixture
def async_channel_messages_service(async_http_client) -> AsyncChannelMessagesService:
return AsyncChannelMessagesService(
http_client=async_http_client,
endpoint_params={"channel_id": "CHN-0000-0000-0001"},
)
def test_endpoint(channel_messages_service) -> None:
result = (
channel_messages_service.path == "/public/v1/helpdesk/channels/CHN-0000-0000-0001/messages"
)
assert result is True
def test_async_endpoint(async_channel_messages_service) -> None:
result = (
async_channel_messages_service.path
== "/public/v1/helpdesk/channels/CHN-0000-0000-0001/messages"
)
assert result is True
@pytest.mark.parametrize("method", ["fetch_page", "iterate"])
def test_methods_present(channel_messages_service, method: str) -> None:
result = hasattr(channel_messages_service, method)
assert result is True
@pytest.mark.parametrize("method", ["get", "create", "update", "delete"])
def test_methods_absent(channel_messages_service, method: str) -> None:
result = hasattr(channel_messages_service, method)
assert result is False
@pytest.mark.parametrize("method", ["fetch_page", "iterate"])
def test_async_methods_present(async_channel_messages_service, method: str) -> None:
result = hasattr(async_channel_messages_service, method)
assert result is True
@pytest.mark.parametrize("method", ["get", "create", "update", "delete"])
def test_async_methods_absent(async_channel_messages_service, method: str) -> None:
result = hasattr(async_channel_messages_service, method)
assert result is False