Skip to content

Commit

Permalink
Test case added
Browse files Browse the repository at this point in the history
  • Loading branch information
dukris committed Feb 6, 2024
1 parent da8ca7c commit 6d5de13
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,29 @@ void createsWebhookSuccessfully() throws IOException {
container.stop();
}

@Test
void doesNotCreateWebhookWhenAlreadyExists() throws IOException {
final MkContainer container = new MkGrizzlyContainer()
.next(
new MkAnswer.Simple(
HttpURLConnection.HTTP_OK,
"[{\"config\":{\"content_type\":\"json\",\"url\":\"test/url\"},\"events\":[\"push\"]}]"
)
).start();
final String location = "user/repo";
final String url = container.home().toString();
new CreateWebhook(
url.substring(0, url.length() - 1),
"token",
location,
"test/url"
).exec();
MatcherAssert.assertThat(
"Webhook is created when it already exists",
container.take().uri().toString(),
new IsEqual<>("/repos/%s/hooks".formatted(location))
);
container.stop();
}

}

0 comments on commit 6d5de13

Please sign in to comment.