Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangyan99 committed Jun 17, 2019
1 parent c138ee8 commit 9156aeb
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ class AutoRestLongRunningOperationTestService(object):
"""Long-running Operation for AutoRest
:ivar lr_os: LROs operations
:vartype lr_os: lro.operations.LROsOperations
:ivar lros: LROs operations
:vartype lros: lro.operations.LROsOperations
:ivar lro_retrys: LRORetrys operations
:vartype lro_retrys: lro.operations.LRORetrysOperations
:ivar lrosa_ds: LROSADs operations
:vartype lrosa_ds: lro.operations.LROSADsOperations
:ivar lrosads: LROSADs operations
:vartype lrosads: lro.operations.LROSADsOperations
:ivar lr_os_custom_header: LROsCustomHeader operations
:vartype lr_os_custom_header: lro.operations.LROsCustomHeaderOperations
Expand All @@ -52,11 +52,11 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.lr_os = LROsOperations(
self.lros = LROsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.lro_retrys = LRORetrysOperations(
self._client, self._config, self._serialize, self._deserialize)
self.lrosa_ds = LROSADsOperations(
self.lrosads = LROSADsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.lr_os_custom_header = LROsCustomHeaderOperations(
self._client, self._config, self._serialize, self._deserialize)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ class AutoRestLongRunningOperationTestService(object):
"""Long-running Operation for AutoRest
:ivar lr_os: LROs operations
:vartype lr_os: lro.operations.LROsOperations
:ivar lros: LROs operations
:vartype lros: lro.operations.LROsOperations
:ivar lro_retrys: LRORetrys operations
:vartype lro_retrys: lro.operations.LRORetrysOperations
:ivar lrosa_ds: LROSADs operations
:vartype lrosa_ds: lro.operations.LROSADsOperations
:ivar lrosads: LROSADs operations
:vartype lrosads: lro.operations.LROSADsOperations
:ivar lr_os_custom_header: LROsCustomHeader operations
:vartype lr_os_custom_header: lro.operations.LROsCustomHeaderOperations
Expand All @@ -52,11 +52,11 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.lr_os = LROsOperations(
self.lros = LROsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.lro_retrys = LRORetrysOperations(
self._client, self._config, self._serialize, self._deserialize)
self.lrosa_ds = LROSADsOperations(
self.lrosads = LROSADsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.lr_os_custom_header = LROsCustomHeaderOperations(
self._client, self._config, self._serialize, self._deserialize)
Expand Down
2 changes: 1 addition & 1 deletion test/vanilla/AcceptanceTests/asynctests/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ async def test_redirect_status_codes(self, client):
@pytest.mark.asyncio
async def test_success_status_codes(self, client):

await self.assertRaisesWithMessage("Operation returned an invalid status code 'Bad Request'",
await self.assertRaisesWithMessage("Operation returned an invalid status 'Bad Request'",
client.http_failure.get_empty_error)
await self.assertRaisesWithStatusAndResponseContains(requests.codes.bad_request, "NoErrorModel",
client.http_failure.get_no_model_error)
Expand Down
2 changes: 1 addition & 1 deletion test/vanilla/AcceptanceTests/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def test_redirect_status_codes(self, client):

def test_success_status_codes(self, client):

self.assertRaisesWithMessage("Operation returned an invalid status code 'Bad Request'",
self.assertRaisesWithMessage("Operation returned an invalid status 'Bad Request'",
client.http_failure.get_empty_error)
self.assertRaisesWithStatusAndResponseContains(requests.codes.bad_request, "NoErrorModel",
client.http_failure.get_no_model_error)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ async def get_file(self, *, cls=None, **kwargs):
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise models.ErrorException(response, self._deserialize)

deserialized = response.stream_download(self._client._pipeline)
deserialized = None
if response.status_code == 200:
deserialized = response.stream_download(self._client._pipeline)

if cls:
return cls(response, deserialized, None)
Expand Down Expand Up @@ -103,7 +105,9 @@ async def get_file_large(self, *, cls=None, **kwargs):
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise models.ErrorException(response, self._deserialize)

deserialized = response.stream_download(self._client._pipeline)
deserialized = None
if response.status_code == 200:
deserialized = response.stream_download(self._client._pipeline)

if cls:
return cls(response, deserialized, None)
Expand Down Expand Up @@ -141,7 +145,9 @@ async def get_empty_file(self, *, cls=None, **kwargs):
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise models.ErrorException(response, self._deserialize)

deserialized = response.stream_download(self._client._pipeline)
deserialized = None
if response.status_code == 200:
deserialized = response.stream_download(self._client._pipeline)

if cls:
return cls(response, deserialized, None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def get_file(self, cls=None, **kwargs):
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise models.ErrorException(response, self._deserialize)

deserialized = response.stream_download(self._client._pipeline)
deserialized = None
if response.status_code == 200:
deserialized = response.stream_download(self._client._pipeline)

if cls:
return cls(response, deserialized, None)
Expand Down Expand Up @@ -101,7 +103,9 @@ def get_file_large(self, cls=None, **kwargs):
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise models.ErrorException(response, self._deserialize)

deserialized = response.stream_download(self._client._pipeline)
deserialized = None
if response.status_code == 200:
deserialized = response.stream_download(self._client._pipeline)

if cls:
return cls(response, deserialized, None)
Expand Down Expand Up @@ -138,7 +142,9 @@ def get_empty_file(self, cls=None, **kwargs):
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise models.ErrorException(response, self._deserialize)

deserialized = response.stream_download(self._client._pipeline)
deserialized = None
if response.status_code == 200:
deserialized = response.stream_download(self._client._pipeline)

if cls:
return cls(response, deserialized, None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ async def upload_file(self, file_content, file_name, *, cls=None, **kwargs):
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise models.ErrorException(response, self._deserialize)

deserialized = response.stream_download(self._client._pipeline)
deserialized = None
if response.status_code == 200:
deserialized = response.stream_download(self._client._pipeline)

if cls:
return cls(response, deserialized, None)
Expand Down Expand Up @@ -120,7 +122,9 @@ async def upload_file_via_body(self, file_content, *, cls=None, **kwargs):
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise models.ErrorException(response, self._deserialize)

deserialized = response.stream_download(self._client._pipeline)
deserialized = None
if response.status_code == 200:
deserialized = response.stream_download(self._client._pipeline)

if cls:
return cls(response, deserialized, None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ def upload_file(self, file_content, file_name, cls=None, **kwargs):
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise models.ErrorException(response, self._deserialize)

deserialized = response.stream_download(self._client._pipeline)
deserialized = None
if response.status_code == 200:
deserialized = response.stream_download(self._client._pipeline)

if cls:
return cls(response, deserialized, None)
Expand Down Expand Up @@ -118,7 +120,9 @@ def upload_file_via_body(self, file_content, cls=None, **kwargs):
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise models.ErrorException(response, self._deserialize)

deserialized = response.stream_download(self._client._pipeline)
deserialized = None
if response.status_code == 200:
deserialized = response.stream_download(self._client._pipeline)

if cls:
return cls(response, deserialized, None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -703,9 +703,9 @@ class Metrics(Model):
:param enabled: Required. Indicates whether metrics are enabled for the
Blob service.
:type enabled: bool
:param include_ap_is: Indicates whether metrics should generate summary
:param include_apis: Indicates whether metrics should generate summary
statistics for called API operations.
:type include_ap_is: bool
:type include_apis: bool
:param retention_policy:
:type retention_policy: ~xmlservice.models.RetentionPolicy
"""
Expand All @@ -717,7 +717,7 @@ class Metrics(Model):
_attribute_map = {
'version': {'key': 'Version', 'type': 'str', 'xml': {'name': 'Version'}},
'enabled': {'key': 'Enabled', 'type': 'bool', 'xml': {'name': 'Enabled'}},
'include_ap_is': {'key': 'IncludeAPIs', 'type': 'bool', 'xml': {'name': 'IncludeAPIs'}},
'include_apis': {'key': 'IncludeAPIs', 'type': 'bool', 'xml': {'name': 'IncludeAPIs'}},
'retention_policy': {'key': 'RetentionPolicy', 'type': 'RetentionPolicy', 'xml': {'name': 'RetentionPolicy'}},
}
_xml_map = {
Expand All @@ -727,7 +727,7 @@ def __init__(self, **kwargs):
super(Metrics, self).__init__(**kwargs)
self.version = kwargs.get('version', None)
self.enabled = kwargs.get('enabled', None)
self.include_ap_is = kwargs.get('include_ap_is', None)
self.include_apis = kwargs.get('include_apis', None)
self.retention_policy = kwargs.get('retention_policy', None)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -703,9 +703,9 @@ class Metrics(Model):
:param enabled: Required. Indicates whether metrics are enabled for the
Blob service.
:type enabled: bool
:param include_ap_is: Indicates whether metrics should generate summary
:param include_apis: Indicates whether metrics should generate summary
statistics for called API operations.
:type include_ap_is: bool
:type include_apis: bool
:param retention_policy:
:type retention_policy: ~xmlservice.models.RetentionPolicy
"""
Expand All @@ -717,17 +717,17 @@ class Metrics(Model):
_attribute_map = {
'version': {'key': 'Version', 'type': 'str', 'xml': {'name': 'Version'}},
'enabled': {'key': 'Enabled', 'type': 'bool', 'xml': {'name': 'Enabled'}},
'include_ap_is': {'key': 'IncludeAPIs', 'type': 'bool', 'xml': {'name': 'IncludeAPIs'}},
'include_apis': {'key': 'IncludeAPIs', 'type': 'bool', 'xml': {'name': 'IncludeAPIs'}},
'retention_policy': {'key': 'RetentionPolicy', 'type': 'RetentionPolicy', 'xml': {'name': 'RetentionPolicy'}},
}
_xml_map = {
}

def __init__(self, *, enabled: bool, version: str=None, include_ap_is: bool=None, retention_policy=None, **kwargs) -> None:
def __init__(self, *, enabled: bool, version: str=None, include_apis: bool=None, retention_policy=None, **kwargs) -> None:
super(Metrics, self).__init__(**kwargs)
self.version = version
self.enabled = enabled
self.include_ap_is = include_ap_is
self.include_apis = include_apis
self.retention_policy = retention_policy


Expand Down

0 comments on commit 9156aeb

Please sign in to comment.