Skip to content

Commit

Permalink
Update a local extension test to ensure error response is handled cor…
Browse files Browse the repository at this point in the history
…rectly
  • Loading branch information
shenglol committed Oct 18, 2024
1 parent dc5238a commit 7fab0ec
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/Bicep.Local.Deploy.IntegrationTests/EndToEndDeploymentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -439,18 +439,9 @@ param coords {

var extensionMock = StrictMock.Of<LocalExtensibilityHost>();
extensionMock.Setup(x => x.CreateOrUpdate(It.Is<ResourceSpecification>(req => req.Properties["uri"]!.ToString() == "https://api.weather.gov/points/47.6363726,-122.1357068"), It.IsAny<CancellationToken>()))
.Returns<ResourceSpecification, CancellationToken>((req, _) =>
.Returns<ResourceSpecification, CancellationToken>((_, _) =>
{
req.Properties["body"] = """
{
"properties": {
"gridId": "SEW",
"gridX": "131",
"gridY": "68"
}
}
""";
return Task.FromResult(new LocalExtensibilityOperationResponse(new Resource(req.Type, req.ApiVersion, identifiers, req.Properties, "Succeeded"), new ErrorData(new Error() { Code = "Code", Message = "Error message" })));
return Task.FromResult(new LocalExtensibilityOperationResponse(null, new ErrorData(new Error() { Code = "Code", Message = "Error message" })));
});

var dispatcher = BicepTestConstants.CreateModuleDispatcher(services.Build().Construct<IServiceProvider>());
Expand Down

0 comments on commit 7fab0ec

Please sign in to comment.