Skip to content

Commit

Permalink
Test null cert upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Janelle Law committed Jul 27, 2021
1 parent 7d1d84e commit 7bb3963
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/test/java/itest/UploadCertificateIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,25 @@ public class UploadCertificateIT extends StandardSelfTest {
static final String MEDIA_TYPE = "application/pkix-cert";
static final String REQ_URL = String.format("/api/v2/certificates");

@Test
public void shouldThrowOnNullCertificateUpload() throws Exception {

CompletableFuture<Integer> response = new CompletableFuture<>();

webClient
.post(REQ_URL)
.sendMultipartForm(
null,
ar -> {
assertRequestStatus(ar, response);
});
ExecutionException ex =
Assertions.assertThrows(ExecutionException.class, () -> response.get());
MatcherAssert.assertThat(
((HttpStatusException) ex.getCause()).getStatusCode(), Matchers.equalTo(400));
MatcherAssert.assertThat(ex.getCause().getMessage(), Matchers.equalTo("Bad Request"));
}

@Test
public void shouldNotAddEmptyCertToTrustStore() throws Exception {

Expand Down

0 comments on commit 7bb3963

Please sign in to comment.