Skip to content

Commit 47253e9

Browse files
authored
Merge pull request #298 from microsoft/dev
merge dev into pr branch
2 parents f325050 + 388226d commit 47253e9

File tree

4 files changed

+58
-3
lines changed

4 files changed

+58
-3
lines changed

azure-devops/azure/devops/client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def _get_resource_locations(self, url, all_host_types):
187187
try:
188188
logger.debug('File cache hit for options on: %s', url)
189189
self._locations[url] = self._base_deserialize.deserialize_data(OPTIONS_FILE_CACHE[url],
190-
'[ApiResourceLocation]')
190+
'[ApiResourceLocation]')
191191
return self._locations[url]
192192
except DeserializationError as ex:
193193
logger.debug(ex, exc_info=True)

azure-devops/azure/devops/connection.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ def _get_resource_areas(self, force=False):
109109
if not force and RESOURCE_FILE_CACHE[location_client.normalized_url]:
110110
try:
111111
logger.debug('File cache hit for resources on: %s', location_client.normalized_url)
112-
self._resource_areas = location_client._base_deserialize.deserialize_data(RESOURCE_FILE_CACHE[location_client.normalized_url],
113-
'[ResourceAreaInfo]')
112+
self._resource_areas = location_client._base_deserialize.deserialize_data(
113+
RESOURCE_FILE_CACHE[location_client.normalized_url],
114+
'[ResourceAreaInfo]')
114115
return self._resource_areas
115116
except Exception as ex:
116117
logger.debug(ex, exc_info=True)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# --------------------------------------------------------------------------------------------
5+
# Generated file, DO NOT EDIT
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------------------------
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# --------------------------------------------------------------------------------------------
5+
6+
import pprint
7+
import unittest
8+
9+
from msrest import Deserializer
10+
from msrest.universal_http import HTTPClientResponse
11+
12+
13+
class _TestResponse(HTTPClientResponse):
14+
def __init__(self, text):
15+
super(_TestResponse, self).__init__(request=None, internal_response=None)
16+
self._text = text
17+
18+
def text(self, encoding=None):
19+
return self._text
20+
21+
22+
class TestDeserialization(unittest.TestCase):
23+
24+
# https://github.com/microsoft/azure-devops-python-api/issues/268
25+
def test_deserialization_issue_268_50(self):
26+
from azure.devops.v5_0.task_agent import models
27+
self._test_deserialization(models.__dict__.items(), _268_type, _268_json)
28+
29+
# https://github.com/microsoft/azure-devops-python-api/issues/268
30+
def test_deserialization_issue_268_51(self):
31+
from azure.devops.v5_1.task_agent import models
32+
self._test_deserialization(models.__dict__.items(), _268_type, _268_json)
33+
34+
@staticmethod
35+
def _test_deserialization(models, data_type, json):
36+
client_models = {k: v for k, v in models if isinstance(v, type)}
37+
deserializer = Deserializer(client_models)
38+
response = _TestResponse(json)
39+
task_agent_response = deserializer(data_type, response)
40+
pprint.pprint(task_agent_response.__dict__)
41+
42+
43+
if __name__ == '__main__':
44+
unittest.main()
45+
46+
_268_type = 'TaskAgentReference'
47+
_268_json = '{"id":0,"name":null,"version":null,"osDescription":"Foo","provisioningState":null}'

0 commit comments

Comments
 (0)