-
Notifications
You must be signed in to change notification settings - Fork 218
Expand file tree
/
Copy pathtest_issue_268.py
More file actions
46 lines (33 loc) · 1.73 KB
/
test_issue_268.py
File metadata and controls
46 lines (33 loc) · 1.73 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
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
import pprint
import unittest
from azure.core.rest import HttpRequest, HttpResponse
class _TestResponse(HTTPClientResponse):
def __init__(self, text):
super(_TestResponse, self).__init__(request=None, internal_response=None)
self._text = text
def text(self, encoding=None):
return self._text
class TestDeserialization(unittest.TestCase):
# https://github.com/microsoft/azure-devops-python-api/issues/268
def test_deserialization_issue_268_71(self):
from azure.devops.v7_1.task_agent import models
self._test_deserialization(models.__dict__.items(), _268_type, _268_json)
# https://github.com/microsoft/azure-devops-python-api/issues/268
def test_deserialization_issue_268_70(self):
from azure.devops.v7_0.task_agent import models
self._test_deserialization(models.__dict__.items(), _268_type, _268_json)
@staticmethod
def _test_deserialization(models, data_type, json):
client_models = {k: v for k, v in models if isinstance(v, type)}
deserializer = Deserializer(client_models)
response = _TestResponse(json)
task_agent_response = deserializer(data_type, response)
pprint.pprint(task_agent_response.__dict__)
if __name__ == '__main__':
unittest.main()
_268_type = 'TaskAgentReference'
_268_json = '{"id":0,"name":null,"version":null,"osDescription":"Foo","provisioningState":null}'