use of com.jcabi.github.Repo in project jcabi-github by jcabi.
the class MkEventTest method canGetPresentLabel.
/**
* MkEvent can get present label value from json object.
* @throws Exception If some problem inside
*/
@Test
public void canGetPresentLabel() throws Exception {
final MkStorage storage = new MkStorage.InFile();
final String user = "ken";
final Repo repo = new MkGithub(storage, user).repos().create(new Repos.RepoCreate("foo", false));
final MkIssueEvents events = (MkIssueEvents) (repo.issueEvents());
final String label = "problem";
final int num = events.create(Event.LABELED, 1, user, Optional.of(label)).number();
MatcherAssert.assertThat(new Event.Smart(new MkEvent(storage, user, repo.coordinates(), num)).label().get().name(), Matchers.equalTo(label));
}
use of com.jcabi.github.Repo in project jcabi-github by jcabi.
the class MkEventTest method canGetCreatedAt.
/**
* Can get created_at value from json object.
* @throws Exception If some problem inside
*/
@Test
public void canGetCreatedAt() throws Exception {
final MkStorage storage = new MkStorage.InFile();
final String user = "test_user";
final Repo repo = new MkGithub(storage, user).randomRepo();
final MkIssueEvents events = (MkIssueEvents) (repo.issueEvents());
final int eventnum = events.create("test_type", 1, user, Optional.of("test_label")).number();
MatcherAssert.assertThat(new MkEvent(storage, user, repo.coordinates(), eventnum).json().getString("created_at"), Matchers.notNullValue());
}
use of com.jcabi.github.Repo in project jcabi-github by jcabi.
the class MkForksTest method iteratesForks.
/**
* MkForks can list forks.
* @throws Exception If some problem inside
*/
@Test
public void iteratesForks() throws Exception {
final Repo repo = new MkGithub().randomRepo();
final Fork fork = repo.forks().create("Organization");
final Iterable<Fork> iterate = repo.forks().iterate("Order");
MatcherAssert.assertThat(iterate, Matchers.<Fork>iterableWithSize(1));
MatcherAssert.assertThat(iterate, Matchers.hasItem(fork));
}
use of com.jcabi.github.Repo in project jcabi-github by jcabi.
the class MkGithubTest method canRelogin.
/**
* MkGithub can relogin.
*
* @throws Exception if some problem inside
*/
@Test
public void canRelogin() throws Exception {
final String login = "mark";
final MkGithub github = new MkGithub();
final Repo repo = github.repos().create(NEW_REPO_SETTINGS);
final Issue issue = repo.issues().create("title", "Found a bug");
final Comment comment = github.relogin(login).repos().get(repo.coordinates()).issues().get(issue.number()).comments().post("Nice change");
MatcherAssert.assertThat(new User.Smart(new Comment.Smart(comment).author()).login(), Matchers.not(Matchers.equalTo(new User.Smart(repo.github().users().self()).login())));
MatcherAssert.assertThat(new User.Smart(new Comment.Smart(comment).author()).login(), Matchers.equalTo(login));
}
use of com.jcabi.github.Repo in project jcabi-github by jcabi.
the class MkGithubTest method canCreateRandomRepo.
/**
* MkGithub can create random repo.
* @throws Exception if some problem inside
*/
@Test
public void canCreateRandomRepo() throws Exception {
final MkGithub github = new MkGithub();
final Repo repo = github.randomRepo();
MatcherAssert.assertThat(github.repos().get(repo.coordinates()).coordinates(), Matchers.equalTo(repo.coordinates()));
}
Aggregations