Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Azure/autorest
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Schulte committed May 24, 2016
2 parents 9750fcb + f1f7584 commit 59e6389
Show file tree
Hide file tree
Showing 224 changed files with 2,893 additions and 1,958 deletions.
2 changes: 1 addition & 1 deletion AutoRest/AutoRest.Core/AutoRest.nuget.proj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<SdkNuGetPackage Include="AutoRest">
<PackageVersion>0.16.0$(NightlyBuildVersion)</PackageVersion>
<PackageVersion>0.17.0$(NightlyBuildVersion)</PackageVersion>
<!--Want to prevent NuGet from reporting warnings
like we are not putting assemblies under the \lib folder-->
<NoPackageAnalysis>true</NoPackageAnalysis>
Expand Down
4 changes: 2 additions & 2 deletions AutoRest/AutoRest.Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("Microsoft AutoRest")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")]
[assembly: AssemblyVersion("0.16.0.0")]
[assembly: AssemblyFileVersion("0.16.0.0")]
[assembly: AssemblyVersion("0.17.0.0")]
[assembly: AssemblyFileVersion("0.17.0.0")]

[assembly: NeutralResourcesLanguage("en")]
[assembly: CLSCompliant(true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Microsoft.Rest.Generator.Azure.NodeJS
{
public class AzureNodeJSCodeGenerator : NodeJSCodeGenerator
{
private const string ClientRuntimePackage = "ms-rest-azure version 1.13.1";
private const string ClientRuntimePackage = "ms-rest-azure version 1.14.2";

// List of models with paging extensions.
private IList<PageTemplateModel> pageModels;
Expand Down
2 changes: 1 addition & 1 deletion AutoRest/Generators/NodeJS/NodeJS/NodeJSCodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Microsoft.Rest.Generator.NodeJS
{
public class NodeJSCodeGenerator : CodeGenerator
{
private const string ClientRuntimePackage = "ms-rest version 1.13.1";
private const string ClientRuntimePackage = "ms-rest version 1.14.2";

public NodeJsCodeNamer Namer { get; private set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@
from msrest.exceptions import DeserializationError, SerializationError, ClientRequestError
from msrest.authentication import BasicTokenAuthentication

from autorestparameterizedhosttestclient import (
AutoRestParameterizedHostTestClient,
AutoRestParameterizedHostTestClientConfiguration)
from autorestparameterizedhosttestclient import AutoRestParameterizedHostTestClient

from autorestparameterizedhosttestclient.exceptions import ValidationError
from autorestparameterizedhosttestclient.models import Error, ErrorException
Expand All @@ -60,19 +58,13 @@ class CustomBaseUriTests(unittest.TestCase):

def test_custom_base_uri_positive(self):
cred = BasicTokenAuthentication({"access_token" :str(uuid4())})
config = AutoRestParameterizedHostTestClientConfiguration(cred, host="host:3000")

config.log_level = log_level
client = AutoRestParameterizedHostTestClient(config)
client = AutoRestParameterizedHostTestClient(cred, host="host:3000")
client.paths.get_empty("local")

def test_custom_base_uri_negative(self):
cred = BasicTokenAuthentication({"access_token" :str(uuid4())})
config = AutoRestParameterizedHostTestClientConfiguration(cred, host="host:3000")

config.log_level = log_level
config.retry_policy.retries = 0
client = AutoRestParameterizedHostTestClient(config)
client = AutoRestParameterizedHostTestClient(cred, host="host:3000")
client.config.retry_policy.retries = 0
with self.assertRaises(ClientRequestError):
client.paths.get_empty("bad")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@
from msrest.exceptions import DeserializationError
from msrest.authentication import BasicTokenAuthentication

from microsoftazuretesturl import (
MicrosoftAzureTestUrl,
MicrosoftAzureTestUrlConfiguration)
from microsoftazuretesturl import MicrosoftAzureTestUrl

from microsoftazuretesturl.models import ErrorException, SampleResourceGroup

Expand All @@ -62,10 +60,7 @@ def test_azure_url(self):
client_id = str(uuid4())

cred = BasicTokenAuthentication({"access_token" :str(uuid4())})
config = MicrosoftAzureTestUrlConfiguration(cred, sub_id, base_url="http://localhost:3000")

config.log_level = log_level
client = MicrosoftAzureTestUrl(config)
client = MicrosoftAzureTestUrl(cred, sub_id, base_url="http://localhost:3000")

group = client.group.get_sample_resource_group("testgoup101")
self.assertEqual(group.name, "testgroup101")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,15 @@
from msrest.exceptions import DeserializationError
from msrest.authentication import BasicTokenAuthentication

from autorestdurationtestservice import (
AutoRestDurationTestService,
AutoRestDurationTestServiceConfiguration)
from autorestdurationtestservice import AutoRestDurationTestService


class DurationTests(unittest.TestCase):

def test_duration(self):

cred = BasicTokenAuthentication({"access_token" :str(uuid4())})
config = AutoRestDurationTestServiceConfiguration(cred, base_url="http://localhost:3000")
config.log_level = log_level
client = AutoRestDurationTestService(config)
client = AutoRestDurationTestService(cred, base_url="http://localhost:3000")

self.assertIsNone(client.duration.get_null())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,15 @@
from msrest.authentication import BasicTokenAuthentication
from msrestazure.azure_exceptions import CloudError, CloudErrorData

from autorestheadtestservice import (
AutoRestHeadTestService,
AutoRestHeadTestServiceConfiguration)

from autorestheadexceptiontestservice import (
AutoRestHeadExceptionTestService,
AutoRestHeadExceptionTestServiceConfiguration)
from autorestheadtestservice import AutoRestHeadTestService
from autorestheadexceptiontestservice import AutoRestHeadExceptionTestService

class HeadTests(unittest.TestCase):

def test_head(self):

cred = BasicTokenAuthentication({"access_token" :str(uuid4())})
config = AutoRestHeadTestServiceConfiguration(cred, base_url="http://localhost:3000")

config.log_level = log_level
client = AutoRestHeadTestService(config)
client = AutoRestHeadTestService(cred, base_url="http://localhost:3000")

self.assertTrue(client.http_success.head200())
self.assertTrue(client.http_success.head204())
Expand All @@ -77,10 +69,7 @@ class HeadExceptionTest(unittest.TestCase):
def test_head_exception(self):

cred = BasicTokenAuthentication({"access_token" :str(uuid4())})
config = AutoRestHeadExceptionTestServiceConfiguration(cred, base_url="http://localhost:3000")

config.log_level = log_level
client = AutoRestHeadExceptionTestService(config)
client = AutoRestHeadExceptionTestService(cred, base_url="http://localhost:3000")

client.head_exception.head200()
client.head_exception.head204()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,15 @@
from msrest.authentication import BasicTokenAuthentication
from msrestazure.azure_exceptions import CloudError, CloudErrorData

from autorestlongrunningoperationtestservice import (
AutoRestLongRunningOperationTestService,
AutoRestLongRunningOperationTestServiceConfiguration)

from autorestlongrunningoperationtestservice import AutoRestLongRunningOperationTestService
from autorestlongrunningoperationtestservice.models import *

class LroTests(unittest.TestCase):

def setUp(self):

cred = BasicTokenAuthentication({"access_token" :str(uuid4())})
config = AutoRestLongRunningOperationTestServiceConfiguration(cred, base_url="http://localhost:3000")

config.log_level = log_level
self.client = AutoRestLongRunningOperationTestService(config)
self.client = AutoRestLongRunningOperationTestService(cred, base_url="http://localhost:3000")

self.client.config.long_running_operation_timeout = 0
self.client._client._adapter.add_hook("request", self.client._client._adapter._test_pipeline)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,14 @@
from msrestazure.azure_exceptions import CloudError
from msrest.authentication import BasicTokenAuthentication

from autorestpagingtestservice import (
AutoRestPagingTestService,
AutoRestPagingTestServiceConfiguration)
from autorestpagingtestservice import AutoRestPagingTestService
from autorestpagingtestservice.models import PagingGetMultiplePagesWithOffsetOptions

class PagingTests(unittest.TestCase):

def setUp(self):
cred = BasicTokenAuthentication({"access_token" :str(uuid4())})
config = AutoRestPagingTestServiceConfiguration(cred, base_url="http://localhost:3000")
config.log_level = log_level
self.client = AutoRestPagingTestService(config)
self.client = AutoRestPagingTestService(cred, base_url="http://localhost:3000")
self.client._client._adapter.add_hook("request", self.client._client._adapter._test_pipeline)
return super(PagingTests, self).setUp()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,17 @@
sys.path.append(join(tests, "AzureSpecials"))
from msrest.exceptions import DeserializationError

from autorestparametergroupingtestservice import AutoRestParameterGroupingTestServiceConfiguration, AutoRestParameterGroupingTestService
from microsoftazuretesturl import MicrosoftAzureTestUrl, MicrosoftAzureTestUrlConfiguration
from autorestdurationtestservice import AutoRestDurationTestService, AutoRestDurationTestServiceConfiguration
from autorestazurespecialparameterstestclient import AutoRestAzureSpecialParametersTestClient, AutoRestAzureSpecialParametersTestClientConfiguration
from autorestparametergroupingtestservice import AutoRestParameterGroupingTestService
from microsoftazuretesturl import MicrosoftAzureTestUrl
from autorestdurationtestservice import AutoRestDurationTestService
from autorestazurespecialparameterstestclient import AutoRestAzureSpecialParametersTestClient

from autorestparameterizedhosttestclient.exceptions import ValidationError
from autorestparametergroupingtestservice.models import ParameterGroupingPostMultiParamGroupsSecondParamGroup, ParameterGroupingPostOptionalParameters, ParameterGroupingPostRequiredParameters, FirstParameterGroup
from autorestparametergroupingtestservice.models import (
ParameterGroupingPostMultiParamGroupsSecondParamGroup,
ParameterGroupingPostOptionalParameters,
ParameterGroupingPostRequiredParameters,
FirstParameterGroup)

from msrest.authentication import BasicTokenAuthentication

Expand All @@ -71,9 +75,7 @@ def test_parameter_grouping(self):
pathParameter = 'path'

cred = BasicTokenAuthentication({"access_token" :str(uuid4())})
config = AutoRestParameterGroupingTestServiceConfiguration(cred, base_url="http://localhost:3000")
config.log_level = log_level
client = AutoRestParameterGroupingTestService(config)
client = AutoRestParameterGroupingTestService(cred, base_url="http://localhost:3000")

# Valid required parameters
requiredParameters = ParameterGroupingPostRequiredParameters(body=bodyParameter, path=pathParameter, custom_header=headerParameter, query=queryParameter)
Expand Down Expand Up @@ -118,9 +120,7 @@ def test_azure_special_parameters(self):
unencodedPath = 'path1/path2/path3'
unencodedQuery = 'value1&q2=value2&q3=value3'
cred = BasicTokenAuthentication({"access_token" :str(uuid4())})
config = AutoRestAzureSpecialParametersTestClientConfiguration(cred, validSubscription, base_url="http://localhost:3000")
config.log_level = log_level
client = AutoRestAzureSpecialParametersTestClient(config)
client = AutoRestAzureSpecialParametersTestClient(cred, validSubscription, base_url="http://localhost:3000")

client.subscription_in_credentials.post_method_global_not_provided_valid()
client.subscription_in_credentials.post_method_global_valid()
Expand Down Expand Up @@ -154,9 +154,7 @@ def test_azure_odata(self):

validSubscription = '1234-5678-9012-3456'
cred = BasicTokenAuthentication({"access_token" :str(uuid4())})
config = AutoRestAzureSpecialParametersTestClientConfiguration(cred, validSubscription, base_url="http://localhost:3000")
config.log_level = log_level
client = AutoRestAzureSpecialParametersTestClient(config)
client = AutoRestAzureSpecialParametersTestClient(cred, validSubscription, base_url="http://localhost:3000")
client.odata.get_with_filter(filter="id gt 5 and name eq 'foo'", top=10, orderby="id")


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
from msrest.authentication import BasicTokenAuthentication
from msrestazure.azure_exceptions import CloudError, CloudErrorData

from autorestazurespecialparameterstestclient import AutoRestAzureSpecialParametersTestClient, AutoRestAzureSpecialParametersTestClientConfiguration
from autorestazurespecialparameterstestclient import AutoRestAzureSpecialParametersTestClient


class XmsRequestClientIdTests(unittest.TestCase):
Expand All @@ -60,9 +60,7 @@ def test_xms_request_client_id(self):
validClientId = '9C4D50EE-2D56-4CD3-8152-34347DC9F2B0'

cred = BasicTokenAuthentication({"access_token":123})
config = AutoRestAzureSpecialParametersTestClientConfiguration(cred, validSubscription, base_url="http://localhost:3000")
config.log_level = log_level
client = AutoRestAzureSpecialParametersTestClient(config)
client = AutoRestAzureSpecialParametersTestClient(cred, validSubscription, base_url="http://localhost:3000")

custom_headers = {"x-ms-client-request-id": validClientId }

Expand All @@ -79,9 +77,7 @@ def test_custom_named_request_id(self):
expectedRequestId = '9C4D50EE-2D56-4CD3-8152-34347DC9F2B0'

cred = BasicTokenAuthentication({"access_token":123})
config = AutoRestAzureSpecialParametersTestClientConfiguration(cred, validSubscription, base_url="http://localhost:3000")
config.log_level = log_level
client = AutoRestAzureSpecialParametersTestClient(config)
client = AutoRestAzureSpecialParametersTestClient(cred, validSubscription, base_url="http://localhost:3000")

response = client.header.custom_named_request_id(expectedRequestId, raw=True)
self.assertEqual("123", response.response.headers.get("foo-request-id"))
Expand All @@ -91,9 +87,7 @@ def test_client_request_id_in_exception(self):
expectedRequestId = '9C4D50EE-2D56-4CD3-8152-34347DC9F2B0'

cred = BasicTokenAuthentication({"access_token":123})
config = AutoRestAzureSpecialParametersTestClientConfiguration(cred, validSubscription, base_url="http://localhost:3000")
config.log_level = log_level
client = AutoRestAzureSpecialParametersTestClient(config)
client = AutoRestAzureSpecialParametersTestClient(cred, validSubscription, base_url="http://localhost:3000")

try:
client.xms_client_request_id.get()
Expand All @@ -107,10 +101,8 @@ def test_xms_request_client_id_in_client(self):
expectedRequestId = '9C4D50EE-2D56-4CD3-8152-34347DC9F2B0'

cred = BasicTokenAuthentication({"access_token":123})
config = AutoRestAzureSpecialParametersTestClientConfiguration(cred, validSubscription, base_url="http://localhost:3000")
config.log_level = log_level
config.generate_client_request_id = False
client = AutoRestAzureSpecialParametersTestClient(config)
client = AutoRestAzureSpecialParametersTestClient(cred, validSubscription, base_url="http://localhost:3000")
client.config.generate_client_request_id = False
client.xms_client_request_id.get()


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

from msrest.exceptions import DeserializationError

from autorestreportserviceforazure import AutoRestReportServiceForAzureConfiguration, AutoRestReportServiceForAzure
from autorestreportserviceforazure import AutoRestReportServiceForAzure
from msrest.authentication import BasicTokenAuthentication


Expand All @@ -57,9 +57,7 @@ class AcceptanceTests(unittest.TestCase):
def test_ensure_coverage(self):

cred = BasicTokenAuthentication({"access_token" :str(uuid4())})
config = AutoRestReportServiceForAzureConfiguration(cred, base_url="http://localhost:3000")
config.log_level = log_level
client = AutoRestReportServiceForAzure(config)
client = AutoRestReportServiceForAzure(cred, base_url="http://localhost:3000")
report = client.get_report()

skipped = [k for k, v in report.items() if v == 0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@
# regenerated.
# --------------------------------------------------------------------------

from .auto_rest_duration_test_service import AutoRestDurationTestService, AutoRestDurationTestServiceConfiguration
from .auto_rest_duration_test_service import AutoRestDurationTestService
from .version import VERSION

__all__ = [
'AutoRestDurationTestService',
'AutoRestDurationTestServiceConfiguration'
]
__all__ = ['AutoRestDurationTestService']

__version__ = VERSION

Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,38 @@ def __init__(
class AutoRestDurationTestService(object):
"""Test Infrastructure for AutoRest
:param config: Configuration for client.
:type config: AutoRestDurationTestServiceConfiguration
:ivar config: Configuration for client.
:vartype config: AutoRestDurationTestServiceConfiguration
:ivar duration: Duration operations
:vartype duration: .operations.DurationOperations
:param credentials: Gets Azure subscription credentials.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param accept_language: Gets or sets the preferred language for the
response.
:type accept_language: str
:param long_running_operation_retry_timeout: Gets or sets the retry
timeout in seconds for Long Running Operations. Default value is 30.
:type long_running_operation_retry_timeout: int
:param generate_client_request_id: When set to true a unique
x-ms-client-request-id value is generated and included in each request.
Default is true.
:type generate_client_request_id: bool
:param str base_url: Service URL
:param str filepath: Existing config
"""

def __init__(self, config):
def __init__(
self, credentials, accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None):

self._client = ServiceClient(config.credentials, config)
self.config = AutoRestDurationTestServiceConfiguration(credentials, accept_language, long_running_operation_retry_timeout, generate_client_request_id, base_url, filepath)
self._client = ServiceClient(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer()
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.config = config
self.duration = DurationOperations(
self._client, self.config, self._serialize, self._deserialize)
Loading

0 comments on commit 59e6389

Please sign in to comment.