-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simple test for case where organisation is missing from a payload
- Loading branch information
1 parent
3b8e91d
commit e445fdf
Showing
2 changed files
with
567 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package io.quarkus.bot.it; | ||
|
||
import io.quarkiverse.githubapp.testing.GitHubAppTest; | ||
import io.quarkus.test.junit.QuarkusTest; | ||
import org.junit.jupiter.api.Test; | ||
import org.kohsuke.github.GHEvent; | ||
|
||
import java.io.IOException; | ||
|
||
import static io.quarkiverse.githubapp.testing.GitHubAppTesting.given; | ||
import static org.mockito.Mockito.verifyNoMoreInteractions; | ||
|
||
@QuarkusTest | ||
@GitHubAppTest | ||
public class PushToProjectsTest { | ||
|
||
/** | ||
* This is a small little test which ensures that if a payload does not have an organisation, PushToProjects does not crash. | ||
*/ | ||
@Test | ||
void pullRequestLabeledWithNullOrganization() throws IOException { | ||
|
||
given() | ||
.github(mocks -> mocks.configFileFromString( | ||
"quarkus-github-bot.yml", | ||
""" | ||
features: [ PUSH_TO_PROJECTS ] | ||
project: | ||
rules: | ||
- labels: [area/hibernate-validator] | ||
project: 1 | ||
issues: true | ||
pullRequests: false | ||
status: Todo""")) | ||
.when().payloadFromClasspath("/pullrequest-labeled-no-organization.json") | ||
.event(GHEvent.PULL_REQUEST) | ||
.then().github(mocks -> { | ||
// Without an organization, nothing should happen except a not-crash | ||
verifyNoMoreInteractions(mocks.ghObjects()); | ||
}); | ||
} | ||
|
||
} |
Oops, something went wrong.