Skip to content

armgit / floci

Public Imported from GitHub
0

Light, fluffy, and always free - The AWS Local Emulator alternative

fix(sns): TagResource and UntagResource return their Result element (#6411)

lex003b4589645b2b
diff --git a/src/main/java/io/github/hectorvent/floci/services/sns/SnsQueryHandler.java b/src/main/java/io/github/hectorvent/floci/services/sns/SnsQueryHandler.java
index a42e680356..e9a7842217 100644
--- a/src/main/java/io/github/hectorvent/floci/services/sns/SnsQueryHandler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/sns/SnsQueryHandler.java
@@ -587,7 +587,7 @@ public class SnsQueryHandler {
Map<String, String> tags = extractSnsTags(params);
try {
snsService.tagResource(resourceArn, tags, region);
- return Response.ok(AwsQueryResponse.envelopeNoResult("TagResource", AwsNamespaces.SNS)).build();
+ return Response.ok(AwsQueryResponse.envelopeEmptyResult("TagResource", AwsNamespaces.SNS)).build();
} catch (AwsException e) {
return xmlErrorResponse(e);
}
@@ -603,7 +603,7 @@ public class SnsQueryHandler {
}
try {
snsService.untagResource(resourceArn, tagKeys, region);
- return Response.ok(AwsQueryResponse.envelopeNoResult("UntagResource", AwsNamespaces.SNS)).build();
+ return Response.ok(AwsQueryResponse.envelopeEmptyResult("UntagResource", AwsNamespaces.SNS)).build();
} catch (AwsException e) {
return xmlErrorResponse(e);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/sns/SnsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/sns/SnsIntegrationTest.java
index c63a13485d..aedda537e4 100644
--- a/src/test/java/io/github/hectorvent/floci/services/sns/SnsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/sns/SnsIntegrationTest.java
@@ -354,8 +354,35 @@ class SnsIntegrationTest {
.formParam("Tags.member.1.Value", "test")
.when()
.post("/")
+ .then()
+ .statusCode(200)
+ .body(containsString("<TagResourceResult"));
+ }
+
+ @Test
+ @Order(11)
+ void untagResource() {
+ given()
+ .contentType("application/x-www-form-urlencoded")
+ .formParam("Action", "TagResource")
+ .formParam("ResourceArn", topicArn)
+ .formParam("Tags.member.1.Key", "short-lived")
+ .formParam("Tags.member.1.Value", "yes")
+ .when()
+ .post("/")
.then()
.statusCode(200);
+
+ given()
+ .contentType("application/x-www-form-urlencoded")
+ .formParam("Action", "UntagResource")
+ .formParam("ResourceArn", topicArn)
+ .formParam("TagKeys.member.1", "short-lived")
+ .when()
+ .post("/")
+ .then()
+ .statusCode(200)
+ .body(containsString("<UntagResourceResult"));
}
@Test