forked from Azure/azure-powershell
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix access error when subscripiton has no Tags property
- Fix the issue Azure#15425 - Add related test cases
- Loading branch information
Showing
35 changed files
with
83 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,5 +49,70 @@ public void NewPSAzureSubscription() | |
Assert.Equal(psAzureSubscription.SubscriptionPolicies.QuotaId, quotaId); | ||
Assert.Equal(psAzureSubscription.SubscriptionPolicies.SpendingLimit, spendingLimit.ToString()); | ||
} | ||
|
||
|
||
[Fact] | ||
[Trait(Category.AcceptanceType, Category.CheckIn)] | ||
public void ConvertAzureSubscripitonToPSAzureSubscriptionWithTags() | ||
{ | ||
string tenants = new Guid().ToString(), homeTenant = new Guid().ToString(); | ||
var subscription = new AzureSubscription() | ||
{ | ||
Id = new Guid().ToString(), | ||
Name = "Playground-01", | ||
State = "Enabled", | ||
ExtendedProperties = | ||
{ | ||
{ "SubscriptionPolices", @"{""locationPlacementId"":""Internal_2014-09-01"",""quotaId"":""Internal_2014-09-01"",""spendingLimit"":""Off""}" }, | ||
{ "Environment", "AzureCloud" }, | ||
{ "AuthorizationSource", "RoleBased" }, | ||
{ "Account", "[email protected]" }, | ||
{ "ManagedByTenants", tenants }, | ||
{ "Tenants", tenants }, | ||
{ "Tags", @"{""CigdemTestTag"":""Enabled""}" }, | ||
{ "HomeTenant", homeTenant } | ||
} | ||
}; | ||
|
||
var psSubscription = new PSAzureSubscription(subscription); | ||
Assert.Equal(subscription.Id, psSubscription.Id); | ||
Assert.Equal(subscription.Name, psSubscription.Name); | ||
Assert.Equal(subscription.State, psSubscription.State); | ||
Assert.Equal(homeTenant, psSubscription.TenantId); | ||
Assert.Equal(homeTenant, psSubscription.HomeTenantId); | ||
Assert.Equal("Internal_2014-09-01", psSubscription.SubscriptionPolicies.LocationPlacementId); | ||
Assert.Single(psSubscription.Tags); | ||
} | ||
|
||
[Fact] | ||
[Trait(Category.AcceptanceType, Category.CheckIn)] | ||
public void ConvertAzureSubscripitonToPSAzureSubscriptionWithoutTags() | ||
{ | ||
string tenants = new Guid().ToString(), homeTenant = new Guid().ToString(); | ||
var subscription = new AzureSubscription() | ||
{ | ||
Id = new Guid().ToString(), | ||
Name = "Playground-01", | ||
State = "Enabled", | ||
ExtendedProperties = | ||
{ | ||
{ "SubscriptionPolices", @"{""locationPlacementId"":""Internal_2014-09-01"",""quotaId"":""Internal_2014-09-01"",""spendingLimit"":""Off""}" }, | ||
{ "AuthorizationSource", "RoleBased" }, | ||
{ "Account", "[email protected]" }, | ||
{ "ManagedByTenants", tenants }, | ||
{ "Tenants", tenants }, | ||
{ "HomeTenant", homeTenant } | ||
} | ||
}; | ||
|
||
var psSubscription = new PSAzureSubscription(subscription); | ||
Assert.Equal(subscription.Id, psSubscription.Id); | ||
Assert.Equal(subscription.Name, psSubscription.Name); | ||
Assert.Equal(subscription.State, psSubscription.State); | ||
Assert.Equal(homeTenant, psSubscription.TenantId); | ||
Assert.Equal(homeTenant, psSubscription.HomeTenantId); | ||
Assert.Equal("Internal_2014-09-01", psSubscription.SubscriptionPolicies.LocationPlacementId); | ||
Assert.Null(psSubscription.Tags); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+49.6 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Authentication.Abstractions.1.0.0-preview.nupkg
Binary file not shown.
Binary file added
BIN
+148 KB
...alFeed/Microsoft.Azure.PowerShell.Authentication.Abstractions.1.0.0-preview.symbols.nupkg
Binary file not shown.
Binary file added
BIN
+38.3 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Clients.Aks.1.0.0-preview.nupkg
Binary file not shown.
Binary file added
BIN
+78.7 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Clients.Aks.1.0.0-preview.symbols.nupkg
Binary file not shown.
Binary file added
BIN
+49.7 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Clients.Authorization.1.0.0-preview.nupkg
Binary file not shown.
Binary file added
BIN
+109 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Clients.Authorization.1.0.0-preview.symbols.nupkg
Binary file not shown.
Binary file added
BIN
+338 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Clients.Compute.1.0.0-preview.nupkg
Binary file not shown.
Binary file added
BIN
+1 MB
tools/LocalFeed/Microsoft.Azure.PowerShell.Clients.Compute.1.0.0-preview.symbols.nupkg
Binary file not shown.
Binary file added
BIN
+157 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.1.0.0-preview.nupkg
Binary file not shown.
Binary file added
BIN
+428 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.1.0.0-preview.symbols.nupkg
Binary file not shown.
Binary file added
BIN
+47.1 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Clients.KeyVault.1.0.0-preview.nupkg
Binary file not shown.
Binary file added
BIN
+104 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Clients.KeyVault.1.0.0-preview.symbols.nupkg
Binary file not shown.
Binary file added
BIN
+126 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Clients.Monitor.1.0.0-preview.nupkg
Binary file not shown.
Binary file added
BIN
+423 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Clients.Monitor.1.0.0-preview.symbols.nupkg
Binary file not shown.
Binary file added
BIN
+388 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Clients.Network.1.0.0-preview.nupkg
Binary file not shown.
Binary file added
BIN
+1.05 MB
tools/LocalFeed/Microsoft.Azure.PowerShell.Clients.Network.1.0.0-preview.symbols.nupkg
Binary file not shown.
Binary file added
BIN
+54.2 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Clients.PolicyInsights.1.0.0-preview.nupkg
Binary file not shown.
Binary file added
BIN
+115 KB
...s/LocalFeed/Microsoft.Azure.PowerShell.Clients.PolicyInsights.1.0.0-preview.symbols.nupkg
Binary file not shown.
Binary file added
BIN
+306 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Clients.ResourceManager.1.0.0-preview.nupkg
Binary file not shown.
Binary file added
BIN
+883 KB
.../LocalFeed/Microsoft.Azure.PowerShell.Clients.ResourceManager.1.0.0-preview.symbols.nupkg
Binary file not shown.
Binary file added
BIN
+90.7 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Clients.Storage.Management.1.0.0-preview.nupkg
Binary file not shown.
Binary file added
BIN
+331 KB
...calFeed/Microsoft.Azure.PowerShell.Clients.Storage.Management.1.0.0-preview.symbols.nupkg
Binary file not shown.
Binary file added
BIN
+677 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Clients.Websites.1.0.0-preview.nupkg
Binary file not shown.
Binary file added
BIN
+1.48 MB
tools/LocalFeed/Microsoft.Azure.PowerShell.Clients.Websites.1.0.0-preview.symbols.nupkg
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+259 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Common.1.0.0-preview.symbols.nupkg
Binary file not shown.
Binary file added
BIN
+19.6 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Common.Share.1.0.0-preview.nupkg
Binary file not shown.
Binary file added
BIN
+27.5 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Common.Share.1.0.0-preview.symbols.nupkg
Binary file not shown.
Binary file added
BIN
+47.6 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Storage.1.0.0-preview.nupkg
Binary file not shown.
Binary file added
BIN
+56.4 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Storage.1.0.0-preview.symbols.nupkg
Binary file not shown.
Binary file added
BIN
+36.8 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Strategies.1.0.0-preview.nupkg
Binary file not shown.
Binary file added
BIN
+88.1 KB
tools/LocalFeed/Microsoft.Azure.PowerShell.Strategies.1.0.0-preview.symbols.nupkg
Binary file not shown.