mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(account): implement DeleteAlternateContact (#5560)
* fix(account): implement DeleteAlternateContact Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com> * docs(account): document DeleteAlternateContact Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com> --------- Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
This commit is contained in:
1 parent
ad8fba7f45
commit
9174147cb6
6 files changed
+51
-1
No files matched your search
+18
@@ -44,6 +44,18 @@ class AccountAlternateContactIntegrationTest {
|
||||
.post("/getAlternateContact").then().statusCode(400).body("__type", equalTo("SerializationException"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void putThenDeleteThenGetReturnsResourceNotFound() {
|
||||
put("security@example.com").statusCode(200);
|
||||
delete().statusCode(200).body(equalTo(""));
|
||||
get().statusCode(404).body("__type", equalTo("ResourceNotFoundException"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void deleteUnsetContactReturnsResourceNotFound() {
|
||||
delete().statusCode(404).body("__type", equalTo("ResourceNotFoundException"));
|
||||
}
|
||||
|
||||
private static io.restassured.response.ValidatableResponse put(String email) {
|
||||
return given().contentType("application/json").header("Authorization", AUTH)
|
||||
.body("{\"AlternateContactType\":\"SECURITY\",\"Name\":\"Security\",\"Title\":\"Owner\",\"EmailAddress\":\"" + email + "\",\"PhoneNumber\":\"+12025550123\"}")
|
||||
@@ -55,4 +67,10 @@ class AccountAlternateContactIntegrationTest {
|
||||
.body("{\"AlternateContactType\":\"SECURITY\"}")
|
||||
.post("/getAlternateContact").then();
|
||||
}
|
||||
|
||||
private static io.restassured.response.ValidatableResponse delete() {
|
||||
return given().contentType("application/json").header("Authorization", AUTH)
|
||||
.body("{\"AlternateContactType\":\"SECURITY\"}")
|
||||
.post("/deleteAlternateContact").then();
|
||||
}
|
||||
}
|
||||
@@ -64,6 +64,19 @@ class AccountServiceTest {
|
||||
assertEquals("ResourceNotFoundException", error.getErrorCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
void deleteRemovesContactAndDeletingUnsetThrows() {
|
||||
ObjectNode request = contactRequest();
|
||||
service.putAlternateContact(ACCOUNT_ID, request);
|
||||
service.deleteAlternateContact(ACCOUNT_ID, request);
|
||||
AwsException getError = assertThrows(AwsException.class,
|
||||
() -> service.getAlternateContact(ACCOUNT_ID, request));
|
||||
assertEquals("ResourceNotFoundException", getError.getErrorCode());
|
||||
AwsException deleteError = assertThrows(AwsException.class,
|
||||
() -> service.deleteAlternateContact(ACCOUNT_ID, request));
|
||||
assertEquals("ResourceNotFoundException", deleteError.getErrorCode());
|
||||
}
|
||||
|
||||
private ObjectNode contactRequest() {
|
||||
ObjectNode request = mapper.createObjectNode();
|
||||
request.put("AlternateContactType", "SECURITY");
|
||||
|
||||
Reference in new issue
Block a user