Skip to content

Commit

Permalink
Add Batch acceptance test
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Schulte committed May 4, 2016
1 parent 49cc5e0 commit 4c5f556
Show file tree
Hide file tree
Showing 11 changed files with 1,541 additions and 153 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,12 @@ public static void Storage()
SwaggerSpecHelper.RunTests<AzureResourceSchemaCodeGenerator>(
SwaggerFile("storage.json"), ExpectedFolder("Storage"));
}

[Fact]
public static void Batch()
{
SwaggerSpecHelper.RunTests<AzureResourceSchemaCodeGenerator>(
SwaggerFile("BatchManagement.json"), ExpectedFolder("Batch"));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,18 @@
<Content Include="Expected\Storage\Microsoft.Storage.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Expected\Batch\Microsoft.Batch.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="packages.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="Swagger\storage.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Swagger\BatchManagement.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Modelers\Swagger.Tests\AutoRest.Modeler.Swagger.Tests.csproj">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,104 +63,6 @@ public async void GenerateWithEmptyServiceClient()
}");
}

[Fact]
public async void GenerateWithServiceClientWithOneType()
{
await TestGenerate(null, new string[]
{
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Mock.Provider/mockType"
},
@"{
""id"": null,
""$schema"": ""http://json-schema.org/draft-04/schema#"",
""title"": ""Mock.Provider"",
""description"": ""Mock Provider Resource Types"",
""resourceDefinitions"": {
""mockType"": {
""type"": ""object"",
""properties"": {
""type"": {
""enum"": [
""Mock.Provider/mockType""
]
},
""apiVersion"": {
""enum"": [
null
]
}
},
""required"": [
""type"",
""apiVersion"",
""properties""
],
""description"": ""Mock.Provider/mockType""
}
}
}");
}

[Fact]
public async void GenerateWithServiceClientWithTwoTypes()
{
await TestGenerate("2016-05-01", new string[]
{
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Mock.Provider/mockType1",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Mock.Provider/mockType2"
},
@"{
""id"": ""http://schema.management.azure.com/schemas/2016-05-01/Mock.Provider.json#"",
""$schema"": ""http://json-schema.org/draft-04/schema#"",
""title"": ""Mock.Provider"",
""description"": ""Mock Provider Resource Types"",
""resourceDefinitions"": {
""mockType1"": {
""type"": ""object"",
""properties"": {
""type"": {
""enum"": [
""Mock.Provider/mockType1""
]
},
""apiVersion"": {
""enum"": [
""2016-05-01""
]
}
},
""required"": [
""type"",
""apiVersion"",
""properties""
],
""description"": ""Mock.Provider/mockType1""
},
""mockType2"": {
""type"": ""object"",
""properties"": {
""type"": {
""enum"": [
""Mock.Provider/mockType2""
]
},
""apiVersion"": {
""enum"": [
""2016-05-01""
]
}
},
""required"": [
""type"",
""apiVersion"",
""properties""
],
""description"": ""Mock.Provider/mockType2""
}
}
}");
}

[Fact]
public void NormalizeClientModelDoesNothing()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"id": "http://schema.management.azure.com/schemas/2015-12-01/Microsoft.Batch.json#",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Microsoft.Batch",
"description": "Microsoft Batch Resource Types",
"resourceDefinitions": {
"batchAccounts": {
"type": "object",
"properties": {
"type": {
"enum": [
"Microsoft.Batch/batchAccounts"
]
},
"apiVersion": {
"enum": [
"2015-12-01"
]
},
"location": {
"type": "string",
"description": "The region in which the account is created."
},
"tags": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "The user specified tags associated with the account."
},
"properties": {
"autoStorage": {
"$ref": "#/definitions/AutoStorageBaseProperties",
"description": "The properties related to auto storage."
}
}
},
"required": [
"type",
"apiVersion",
"properties"
],
"description": "Microsoft.Batch/batchAccounts"
}
},
"definitions": {
"AutoStorageBaseProperties": {
"type": "object",
"properties": {
"storageAccountId": {
"type": "string",
"description": "The resource id of the storage account to be used for auto storage."
}
},
"required": [
"storageAccountId"
],
"description": "The properties related to auto storage."
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,22 @@
"description": "Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters."
},
"properties": {
"$ref": "#/definitions/StorageAccountPropertiesCreateParameters"
"customDomain": {
"$ref": "#/definitions/CustomDomain",
"description": "User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property."
},
"encryption": {
"$ref": "#/definitions/Encryption",
"description": "Provides the encryption settings on the account. If left unspecified the account encryption settings will remain. The default setting is unencrypted."
},
"accessTier": {
"type": "string",
"enum": [
"Hot",
"Cool"
],
"description": "Required for StandardBlob accounts. The access tier used for billing. Access tier cannot be changed more than once every 7 days (168 hours). Access tier cannot be set for StandardLRS, StandardGRS, StandardRAGRS, or PremiumLRS account types. Possible values include: 'Hot', 'Cool'"
}
}
},
"required": [
Expand Down Expand Up @@ -132,27 +147,6 @@
"name"
],
"description": "The SKU of the storage account."
},
"StorageAccountPropertiesCreateParameters": {
"type": "object",
"properties": {
"customDomain": {
"$ref": "#/definitions/CustomDomain",
"description": "User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property."
},
"encryption": {
"$ref": "#/definitions/Encryption",
"description": "Provides the encryption settings on the account. If left unspecified the account encryption settings will remain. The default setting is unencrypted."
},
"accessTier": {
"type": "string",
"enum": [
"Hot",
"Cool"
],
"description": "Required for StandardBlob accounts. The access tier used for billing. Access tier cannot be changed more than once every 7 days (168 hours). Access tier cannot be set for StandardLRS, StandardGRS, StandardRAGRS, or PremiumLRS account types. Possible values include: 'Hot', 'Cool'"
}
}
}
}
}
Loading

0 comments on commit 4c5f556

Please sign in to comment.