use of com.meisolsson.githubsdk.model.GitHubEvent in project PocketHub by pockethub.
the class RepositoryEventMatcherTest method testIncompleteRepositoryFork.
/**
* Test fork event that has an incomplete forkee in the payload
*/
public void testIncompleteRepositoryFork() {
RepositoryEventMatcher matcher = new RepositoryEventMatcher();
ForkPayload payload = ForkPayload.builder().build();
GitHubEvent event = GitHubEvent.builder().type(GitHubEventType.ForkEvent).payload(payload).build();
assertNull(matcher.getRepository(event));
Repository repository = Repository.builder().build();
payload = payload.toBuilder().forkee(repository).build();
event = event.toBuilder().payload(payload).build();
assertNull(matcher.getRepository(event));
repository = repository.toBuilder().name("repo").build();
payload = payload.toBuilder().forkee(repository).build();
event = event.toBuilder().payload(payload).build();
assertNull(matcher.getRepository(event));
User user = User.builder().build();
repository = repository.toBuilder().owner(user).build();
payload = payload.toBuilder().forkee(repository).build();
event = event.toBuilder().payload(payload).build();
assertNull(matcher.getRepository(event));
user = user.toBuilder().login("owner").build();
repository = repository.toBuilder().owner(user).build();
payload = payload.toBuilder().forkee(repository).build();
event = event.toBuilder().payload(payload).build();
assertEquals(repository, matcher.getRepository(event));
}
use of com.meisolsson.githubsdk.model.GitHubEvent in project PocketHub by pockethub.
the class NewsEventTextTest method testCreateRepositoryEvent.
/**
* Verify text of create event
*/
@UiThreadTest
public void testCreateRepositoryEvent() {
CreatePayload payload = CreatePayload.builder().refType(ReferenceType.Repository).build();
GitHubEvent event = createEvent(GitHubEventType.CreateEvent, payload);
updateView(event);
verify("user created repository repo");
}
use of com.meisolsson.githubsdk.model.GitHubEvent in project PocketHub by pockethub.
the class NewsEventTextTest method testOpenSourced.
/**
* Verify text of open sourced event
*/
@UiThreadTest
public void testOpenSourced() {
GitHubEvent event = createEvent(GitHubEventType.PublicEvent, null);
updateView(event);
verify("user open sourced repository user/repo");
}
use of com.meisolsson.githubsdk.model.GitHubEvent in project PocketHub by pockethub.
the class NewsEventTextTest method testPush.
/**
* Verify text of push event
*/
@UiThreadTest
public void testPush() {
PushPayload payload = PushPayload.builder().ref("refs/heads/master").commits(Collections.emptyList()).build();
GitHubEvent event = createEvent(GitHubEventType.PushEvent, payload);
updateView(event);
verify("user pushed to master at user/repo");
}
use of com.meisolsson.githubsdk.model.GitHubEvent in project PocketHub by pockethub.
the class NewsEventTextTest method testTeamAdd.
/**
* Verify text of push event
*/
@UiThreadTest
public void testTeamAdd() {
Team team = Team.builder().name("t1").build();
Repository repo = Repository.builder().name("r2").build();
TeamAddPayload payload = TeamAddPayload.builder().repository(repo).team(team).build();
GitHubEvent event = createEvent(GitHubEventType.TeamAddEvent, payload);
updateView(event);
verify("user added r2 to team t1");
}
Aggregations