Skip to content

Commit 9078d11

Browse files
committed
added test for includeDeleted true
1 parent d005d6c commit 9078d11

1 file changed

Lines changed: 81 additions & 0 deletions

File tree

tests/test_custom_metadata_fields_ops.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,87 @@ def test_get_custom_metadata_fields_succeeds(self):
131131
responses.calls[0].request.url,
132132
)
133133

134+
@responses.activate
135+
def test_get_custom_metadata_fields_succeeds_with_include_deleted_true(self):
136+
"""
137+
Tests if get_custom_metadata_fields succeeds
138+
"""
139+
URL.API_BASE_URL = "http://test.com"
140+
url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL)
141+
headers = create_headers_for_test()
142+
responses.add(
143+
responses.GET,
144+
url,
145+
body="""[{
146+
"id": "62a9d5f6db485107347bb7f2",
147+
"name": "test10",
148+
"label": "test10",
149+
"schema": {
150+
"type": "Number",
151+
"isValueRequired": false,
152+
"minValue": 10,
153+
"maxValue": 1000
154+
}
155+
}, {
156+
"id": "62aab2cfdb4851833b8f5e64",
157+
"name": "test11",
158+
"label": "test11",
159+
"schema": {
160+
"type": "Number",
161+
"isValueRequired": false,
162+
"minValue": 10,
163+
"maxValue": 1000
164+
}
165+
}]""",
166+
match=[matchers.query_string_matcher("includeDeleted=true")],
167+
headers=headers,
168+
)
169+
resp = self.client.get_custom_metadata_fields(include_deleted=True)
170+
171+
mock_response_metadata = {
172+
"raw": [
173+
{
174+
"id": "62a9d5f6db485107347bb7f2",
175+
"name": "test10",
176+
"label": "test10",
177+
"schema": {
178+
"type": "Number",
179+
"isValueRequired": False,
180+
"minValue": 10,
181+
"maxValue": 1000,
182+
},
183+
},
184+
{
185+
"id": "62aab2cfdb4851833b8f5e64",
186+
"name": "test11",
187+
"label": "test11",
188+
"schema": {
189+
"type": "Number",
190+
"isValueRequired": False,
191+
"minValue": 10,
192+
"maxValue": 1000,
193+
},
194+
},
195+
],
196+
"httpStatusCode": 200,
197+
"headers": {
198+
"Content-Type": "text/plain",
199+
"Accept-Encoding": "gzip, deflate",
200+
"Authorization": "Basic ZmFrZTEyMjo=",
201+
},
202+
}
203+
204+
self.assertEqual(
205+
camel_dict_to_snake_dict(mock_response_metadata),
206+
resp.response_metadata.__dict__,
207+
)
208+
self.assertEqual("62a9d5f6db485107347bb7f2", resp.list[0].id)
209+
self.assertEqual("62aab2cfdb4851833b8f5e64", resp.list[1].id)
210+
self.assertEqual(
211+
"http://test.com/v1/customMetadataFields?includeDeleted=true",
212+
responses.calls[0].request.url,
213+
)
214+
134215
@responses.activate
135216
def test_delete_custom_metadata_fields_succeeds(self):
136217
"""

0 commit comments

Comments
 (0)