Skip to content

Commit 29fdddb

Browse files
committed
Add testing
1 parent c76deb3 commit 29fdddb

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright Consensys Software Inc., 2024
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package tech.pegasys.teku.validator.client.restapi.apis;
15+
16+
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST;
17+
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_FORBIDDEN;
18+
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_INTERNAL_SERVER_ERROR;
19+
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NOT_IMPLEMENTED;
20+
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT;
21+
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_UNAUTHORIZED;
22+
import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataEmptyResponse;
23+
import static tech.pegasys.teku.infrastructure.restapi.MetadataTestUtil.verifyMetadataErrorResponse;
24+
25+
import com.fasterxml.jackson.core.JsonProcessingException;
26+
import org.junit.jupiter.api.Test;
27+
28+
class DeleteGraffitiTest {
29+
private final DeleteGraffiti handler = new DeleteGraffiti();
30+
31+
@Test
32+
void metadata_shouldHandle204() {
33+
verifyMetadataEmptyResponse(handler, SC_NO_CONTENT);
34+
}
35+
36+
@Test
37+
void metadata_shouldHandle400() throws JsonProcessingException {
38+
verifyMetadataErrorResponse(handler, SC_BAD_REQUEST);
39+
}
40+
41+
@Test
42+
void metadata_shouldHandle401() throws JsonProcessingException {
43+
verifyMetadataErrorResponse(handler, SC_UNAUTHORIZED);
44+
}
45+
46+
@Test
47+
void metadata_shouldHandle403() throws JsonProcessingException {
48+
verifyMetadataErrorResponse(handler, SC_FORBIDDEN);
49+
}
50+
51+
@Test
52+
void metadata_shouldHandle500() throws JsonProcessingException {
53+
verifyMetadataErrorResponse(handler, SC_INTERNAL_SERVER_ERROR);
54+
}
55+
56+
@Test
57+
void metadata_shouldHandle501() throws JsonProcessingException {
58+
verifyMetadataErrorResponse(handler, SC_NOT_IMPLEMENTED);
59+
}
60+
}

0 commit comments

Comments
 (0)