Skip to content

Commit 4dfbb3b

Browse files
author
Rachid Cesin Gorostieta
committed
Fix related tests to the removed validation
1 parent 8ca872c commit 4dfbb3b

File tree

1 file changed

+0
-101
lines changed

1 file changed

+0
-101
lines changed

src/ResourceManager/Resources/Commands.Resources.Test/Models.ResourceGroups/ResourceClientTests.cs

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -878,96 +878,6 @@ public void GetResourceWithIncorrectTypeThrowsException()
878878
Assert.Throws<ArgumentException>(() => resourcesClient.FilterPSResources(parameters));
879879
}
880880

881-
[Fact]
882-
[Trait(Category.AcceptanceType, Category.CheckIn)]
883-
public void NewResourceGroupFailsWithInvalidDeployment()
884-
{
885-
Uri templateUri = new Uri("http://templateuri.microsoft.com");
886-
Deployment deploymentFromGet = new Deployment();
887-
Deployment deploymentFromValidate = new Deployment();
888-
CreatePSResourceGroupParameters parameters = new CreatePSResourceGroupParameters()
889-
{
890-
ResourceGroupName = resourceGroupName,
891-
Location = resourceGroupLocation,
892-
DeploymentName = deploymentName,
893-
TemplateFile = templateFile,
894-
StorageAccountName = storageAccountName,
895-
ConfirmAction = ConfirmAction
896-
};
897-
resourceGroupMock.Setup(f => f.CheckExistenceAsync(parameters.ResourceGroupName, new CancellationToken()))
898-
.Returns(Task.Factory.StartNew(() => new ResourceGroupExistsResult
899-
{
900-
Exists = false
901-
}));
902-
903-
resourceGroupMock.Setup(f => f.CreateOrUpdateAsync(
904-
parameters.ResourceGroupName,
905-
It.IsAny<ResourceGroup>(),
906-
new CancellationToken()))
907-
.Returns(Task.Factory.StartNew(() => new ResourceGroupCreateOrUpdateResult
908-
{
909-
ResourceGroup = new ResourceGroupExtended() { Name = parameters.ResourceGroupName, Location = parameters.Location }
910-
}));
911-
resourceGroupMock.Setup(f => f.GetAsync(resourceGroupName, new CancellationToken()))
912-
.Returns(Task.Factory.StartNew(() => new ResourceGroupGetResult
913-
{
914-
ResourceGroup = new ResourceGroupExtended() { Location = resourceGroupLocation }
915-
}));
916-
deploymentsMock.Setup(f => f.CreateOrUpdateAsync(resourceGroupName, deploymentName, It.IsAny<Deployment>(), new CancellationToken()))
917-
.Returns(Task.Factory.StartNew(() => new DeploymentOperationsCreateResult
918-
{
919-
RequestId = requestId
920-
}))
921-
.Callback((string name, string dName, Deployment bDeploy, CancellationToken token) => { deploymentFromGet = bDeploy; });
922-
deploymentsMock.Setup(f => f.GetAsync(resourceGroupName, deploymentName, new CancellationToken()))
923-
.Returns(Task.Factory.StartNew(() => new DeploymentGetResult
924-
{
925-
Deployment = new DeploymentExtended()
926-
{
927-
Name = deploymentName,
928-
Properties = new DeploymentPropertiesExtended()
929-
{
930-
Mode = DeploymentMode.Incremental,
931-
ProvisioningState = ProvisioningState.Succeeded
932-
},
933-
}
934-
}));
935-
deploymentsMock.Setup(f => f.ValidateAsync(resourceGroupName, It.IsAny<string>(), It.IsAny<Deployment>(), new CancellationToken()))
936-
.Returns(Task.Factory.StartNew(() => new DeploymentValidateResponse
937-
{
938-
Error = new ResourceManagementErrorWithDetails()
939-
{
940-
Code = "404",
941-
Message = "Awesome error message",
942-
Target = "Bad deployment"
943-
}
944-
}))
945-
.Callback((string rg, string dn, Deployment d, CancellationToken c) => { deploymentFromValidate = d; });
946-
SetupListForResourceGroupAsync(parameters.ResourceGroupName, new List<GenericResourceExtended>() { new GenericResourceExtended() { Name = "website" } });
947-
deploymentOperationsMock.Setup(f => f.ListAsync(resourceGroupName, deploymentName, null, new CancellationToken()))
948-
.Returns(Task.Factory.StartNew(() => new DeploymentOperationsListResult
949-
{
950-
Operations = new List<DeploymentOperation>()
951-
{
952-
new DeploymentOperation()
953-
{
954-
OperationId = Guid.NewGuid().ToString(),
955-
Properties = new DeploymentOperationProperties()
956-
{
957-
ProvisioningState = ProvisioningState.Succeeded,
958-
TargetResource = new TargetResource()
959-
{
960-
ResourceName = resourceName,
961-
ResourceType = "Microsoft.Website"
962-
}
963-
}
964-
}
965-
}
966-
}));
967-
968-
Assert.Throws<ArgumentException>(() => resourcesClient.CreatePSResourceGroup(parameters));
969-
}
970-
971881
[Fact]
972882
[Trait(Category.AcceptanceType, Category.CheckIn)]
973883
public void TestTemplateShowsErrorMessage()
@@ -1304,9 +1214,6 @@ public void NewResourceGroupWithDeploymentSucceeds()
13041214
Assert.Equal(DeploymentMode.Incremental, deploymentFromGet.Properties.Mode);
13051215
Assert.NotNull(deploymentFromGet.Properties.Template);
13061216

1307-
Assert.Equal(DeploymentMode.Incremental, deploymentFromValidate.Properties.Mode);
1308-
Assert.NotNull(deploymentFromValidate.Properties.Template);
1309-
13101217
progressLoggerMock.Verify(
13111218
f => f(string.Format("Resource {0} '{1}' provisioning status is {2}",
13121219
"Microsoft.Website",
@@ -1417,8 +1324,6 @@ public void CreatesResourceGroupWithDeploymentFromTemplateParameterObject()
14171324
// Skip: Test produces different outputs since hashtable order is not guaranteed.
14181325
//EqualsIgnoreWhitespace(File.ReadAllText(templateParameterFile), deploymentFromGet.Parameters);
14191326

1420-
Assert.Equal(DeploymentMode.Incremental, deploymentFromValidate.Properties.Mode);
1421-
Assert.NotNull(deploymentFromValidate.Properties.Template);
14221327
// Skip: Test produces different outputs since hashtable order is not guaranteed.
14231328
//EqualsIgnoreWhitespace(File.ReadAllText(templateParameterFile), deploymentFromValidate.Parameters);
14241329

@@ -1524,9 +1429,6 @@ public void ShowsFailureErrorWhenResourceGroupWithDeploymentFails()
15241429
Assert.Equal(DeploymentMode.Incremental, deploymentFromGet.Properties.Mode);
15251430
Assert.NotNull(deploymentFromGet.Properties.Template);
15261431

1527-
Assert.Equal(DeploymentMode.Incremental, deploymentFromValidate.Properties.Mode);
1528-
Assert.NotNull(deploymentFromValidate.Properties.Template);
1529-
15301432
errorLoggerMock.Verify(
15311433
f => f(string.Format("Resource {0} '{1}' failed with message '{2}'",
15321434
"Microsoft.Website",
@@ -1632,9 +1534,6 @@ public void ExtractsErrorMessageFromFailedDeploymentOperation()
16321534
Assert.Equal(DeploymentMode.Incremental, deploymentFromGet.Properties.Mode);
16331535
Assert.NotNull(deploymentFromGet.Properties.Template);
16341536

1635-
Assert.Equal(DeploymentMode.Incremental, deploymentFromValidate.Properties.Mode);
1636-
Assert.NotNull(deploymentFromValidate.Properties.Template);
1637-
16381537
errorLoggerMock.Verify(
16391538
f => f(string.Format("Resource {0} '{1}' failed with message '{2}'",
16401539
"Microsoft.Website",

0 commit comments

Comments
 (0)