1+ import os
2+ import pytest
3+ from merge import Merge
4+ from merge .resources .knowledgebase .resources .articles .types .articles_list_request_expand import ArticlesListRequestExpand
5+ from merge .resources .knowledgebase .resources .articles .types .articles_retrieve_request_expand import ArticlesRetrieveRequestExpand
6+ from merge .resources .knowledgebase .resources .containers .types .containers_list_request_expand import ContainersListRequestExpand
7+ from merge .resources .knowledgebase .resources .containers .types .containers_retrieve_request_expand import ContainersRetrieveRequestExpand
8+ from merge .resources .knowledgebase .resources .groups .types .groups_list_request_expand import GroupsListRequestExpand
9+ from merge .resources .knowledgebase .resources .groups .types .groups_retrieve_request_expand import GroupsRetrieveRequestExpand
10+
11+
12+ @pytest .fixture
13+ def client ():
14+ account_token = os .environ ["SDK_TESTING_KNOWLEDGEBASE_ACCOUNT_TOKEN" ]
15+ api_key = os .environ ["SDK_TESTING_KEY" ]
16+
17+ return Merge (
18+ account_token = account_token ,
19+ api_key = api_key ,
20+ )
21+
22+ def test_articles_list (client ):
23+ response = client .knowledgebase .articles .list ()
24+ assert response is not None
25+ assert hasattr (response , 'results' )
26+ assert isinstance (response .results , list )
27+
28+ def test_articles_list_with_expand_author (client ):
29+ response = client .knowledgebase .articles .list (expand = ArticlesListRequestExpand .AUTHOR )
30+ assert response is not None
31+ assert hasattr (response , 'results' )
32+ assert isinstance (response .results , list )
33+
34+ def test_articles_list_with_expand_attachments (client ):
35+ response = client .knowledgebase .articles .list (expand = ArticlesListRequestExpand .ATTACHMENTS )
36+ assert response is not None
37+ assert hasattr (response , 'results' )
38+ assert isinstance (response .results , list )
39+
40+ def test_articles_list_with_expand_permissions (client ):
41+ response = client .knowledgebase .articles .list (expand = ArticlesListRequestExpand .PERMISSIONS )
42+ assert response is not None
43+ assert hasattr (response , 'results' )
44+ assert isinstance (response .results , list )
45+
46+ def test_attachments_list (client ):
47+ response = client .knowledgebase .attachments .list ()
48+ assert response is not None
49+ assert hasattr (response , 'results' )
50+ assert isinstance (response .results , list )
51+
52+ def test_attachments_retrieve (client ):
53+ attachments_response = client .knowledgebase .attachments .list (page_size = 1 )
54+
55+ if attachments_response .results :
56+ attachment_id = attachments_response .results [0 ].id
57+ attachment = client .knowledgebase .attachments .retrieve (id = attachment_id )
58+ assert attachment is not None
59+ assert attachment .id == attachment_id
60+
61+ def test_containers_list (client ):
62+ response = client .knowledgebase .containers .list ()
63+ assert response is not None
64+ assert hasattr (response , 'results' )
65+ assert isinstance (response .results , list )
66+
67+ def test_containers_retrieve (client ):
68+ containers_response = client .knowledgebase .containers .list (page_size = 1 )
69+
70+ if containers_response .results :
71+ container_id = containers_response .results [0 ].id
72+ container = client .knowledgebase .containers .retrieve (id = container_id )
73+ assert container is not None
74+ assert container .id == container_id
75+
76+ def test_containers_list_with_expand_permissions (client ):
77+ response = client .knowledgebase .containers .list (expand = ContainersListRequestExpand .PERMISSIONS )
78+ assert response is not None
79+ assert hasattr (response , 'results' )
80+ assert isinstance (response .results , list )
81+
82+ def test_containers_list_with_expand_parent_container (client ):
83+ response = client .knowledgebase .containers .list (expand = ContainersListRequestExpand .PARENT_CONTAINER )
84+ assert response is not None
85+ assert hasattr (response , 'results' )
86+ assert isinstance (response .results , list )
87+
88+ def test_containers_retrieve_with_expand_permissions (client ):
89+ containers_response = client .knowledgebase .containers .list (page_size = 1 )
90+
91+ if containers_response .results :
92+ container_id = containers_response .results [0 ].id
93+ container = client .knowledgebase .containers .retrieve (id = container_id , expand = ContainersRetrieveRequestExpand .PERMISSIONS )
94+ assert container is not None
95+ assert container .id == container_id
96+
97+ def test_containers_retrieve_with_expand_parent_container (client ):
98+ containers_response = client .knowledgebase .containers .list (page_size = 1 )
99+
100+ if containers_response .results :
101+ container_id = containers_response .results [0 ].id
102+ container = client .knowledgebase .containers .retrieve (id = container_id , expand = ContainersRetrieveRequestExpand .PARENT_CONTAINER )
103+ assert container is not None
104+ assert container .id == container_id
105+
106+ def test_sync_status_list (client ):
107+ response = client .knowledgebase .sync_status .list ()
108+ assert response is not None
109+ assert hasattr (response , 'results' )
110+ assert isinstance (response .results , list )
111+
112+ def test_account_details_retrieve (client ):
113+ account_details = client .knowledgebase .account_details .retrieve ()
114+ assert account_details is not None
115+ assert hasattr (account_details , 'id' )
116+
117+ def test_users_list (client ):
118+ response = client .knowledgebase .users .list ()
119+ assert response is not None
120+ assert hasattr (response , 'results' )
121+ assert isinstance (response .results , list )
122+
123+ def test_users_retrieve (client ):
124+ users_response = client .knowledgebase .users .list (page_size = 1 )
125+
126+ if users_response .results :
127+ user_id = users_response .results [0 ].id
128+ user = client .knowledgebase .users .retrieve (id = user_id )
129+
130+ assert user is not None
131+ assert user .id == user_id
132+
133+ def test_groups_list (client ):
134+ response = client .knowledgebase .groups .list ()
135+ assert response is not None
136+ assert hasattr (response , 'results' )
137+ assert isinstance (response .results , list )
138+
139+ def test_groups_list_with_expand_users (client ):
140+ response = client .knowledgebase .groups .list (expand = GroupsListRequestExpand .USERS )
141+ assert response is not None
142+ assert hasattr (response , 'results' )
143+ assert isinstance (response .results , list )
144+
145+ def test_groups_list_with_expand_parent_group (client ):
146+ response = client .knowledgebase .groups .list (expand = GroupsListRequestExpand .PARENT_GROUP )
147+ assert response is not None
148+ assert hasattr (response , 'results' )
149+ assert isinstance (response .results , list )
150+
151+ def test_audit_trail_list (client ):
152+ response = client .knowledgebase .audit_trail .list ()
153+ assert response is not None
154+ assert hasattr (response , 'results' )
155+ assert isinstance (response .results , list )
156+
157+ def test_available_actions_retrieve (client ):
158+ available_actions = client .knowledgebase .available_actions .retrieve ()
159+
160+ assert available_actions is not None
161+
162+ def test_linked_accounts_list (client ):
163+ response = client .knowledgebase .linked_accounts .list ()
164+
165+ assert response is not None
166+ assert hasattr (response , 'results' )
167+ assert isinstance (response .results , list )
168+
169+ def test_scopes_default_scopes_retrieve (client ):
170+ response = client .knowledgebase .scopes .default_scopes_retrieve ()
171+
172+ assert response is not None
173+
174+ def test_scopes_linked_account_scopes_retrieve (client ):
175+ response = client .knowledgebase .scopes .linked_account_scopes_retrieve ()
176+
177+ assert response is not None
0 commit comments