Search in sources :

Example 51 with Repo

use of com.jcabi.github.Repo in project jcabi-github by jcabi.

the class MkPullRefTest method fetchesRepo.

/**
 * MkPullRef can fetch its repo.
 * @throws IOException If there is an I/O problem
 */
@Test
public void fetchesRepo() throws IOException {
    final MkStorage storage = new MkStorage.InFile();
    final Repo repo = new MkGithub(storage, MkPullRefTest.USERNAME).randomRepo();
    MatcherAssert.assertThat(MkPullRefTest.pullRef(storage, repo).repo().coordinates(), Matchers.equalTo(repo.coordinates()));
}
Also used : Repo(com.jcabi.github.Repo) Test(org.junit.Test)

Example 52 with Repo

use of com.jcabi.github.Repo in project jcabi-github by jcabi.

the class MkPullsTest method canCreateAPull.

/**
 * MkPulls can create a pull.
 * It should create an issue first, and then pull with the same number
 * @throws Exception if some problem inside
 */
@Test
public void canCreateAPull() throws Exception {
    final Repo repo = new MkGithub().randomRepo();
    final Pull pull = repo.pulls().create("hello", "head-branch", "base-branch");
    final Issue.Smart issue = new Issue.Smart(repo.issues().get(pull.number()));
    MatcherAssert.assertThat(issue.title(), Matchers.is("hello"));
}
Also used : Pull(com.jcabi.github.Pull) Issue(com.jcabi.github.Issue) Repo(com.jcabi.github.Repo) Test(org.junit.Test)

Example 53 with Repo

use of com.jcabi.github.Repo in project jcabi-github by jcabi.

the class MkReferencesTest method iteratesReferencesInSubNamespace.

/**
 * MkReferences can iterate over references in sub-namespace.
 * @throws Exception - If something goes wrong.
 */
@Test
public void iteratesReferencesInSubNamespace() throws Exception {
    final Repo owner = new MkGithub().randomRepo();
    final References refs = owner.git().references();
    refs.create("refs/heads/br", "qweqwe");
    refs.create("refs/tags/t1", "111t222");
    MatcherAssert.assertThat(refs.iterate("heads"), Matchers.<Reference>iterableWithSize(1));
    MatcherAssert.assertThat(refs.iterate("tags"), Matchers.<Reference>iterableWithSize(1));
}
Also used : Repo(com.jcabi.github.Repo) References(com.jcabi.github.References) Test(org.junit.Test)

Example 54 with Repo

use of com.jcabi.github.Repo in project jcabi-github by jcabi.

the class MkReferencesTest method iteratesHeads.

/**
 * MkReferences can iterate over references in Tagsub-namespace.
 * @throws Exception - If something goes wrong.
 */
@Test
public void iteratesHeads() throws Exception {
    final Repo owner = new MkGithub().randomRepo();
    final References refs = owner.git().references();
    refs.create("refs/heads/branch2", "blahblah");
    MatcherAssert.assertThat(refs.heads(), Matchers.<Reference>iterableWithSize(1));
}
Also used : Repo(com.jcabi.github.Repo) References(com.jcabi.github.References) Test(org.junit.Test)

Example 55 with Repo

use of com.jcabi.github.Repo in project jcabi-github by jcabi.

the class MkSearchTest method canSearchForIssues.

/**
 * MkSearch can search for issues.
 *
 * @throws Exception if a problem occurs
 */
@Test
public void canSearchForIssues() throws Exception {
    final MkGithub github = new MkGithub();
    final Repo repo = github.repos().create(new Repos.RepoCreate("TestIssues", false));
    repo.issues().create("test issue", "TheTest");
    MatcherAssert.assertThat(github.search().issues("TheTest", "updated", Search.Order.DESC, new EnumMap<Search.Qualifier, String>(Search.Qualifier.class)), Matchers.not(Matchers.emptyIterable()));
}
Also used : Repos(com.jcabi.github.Repos) Repo(com.jcabi.github.Repo) Search(com.jcabi.github.Search) EnumMap(java.util.EnumMap) Test(org.junit.Test)

Aggregations

Repo (com.jcabi.github.Repo)57 Test (org.junit.Test)55 Coordinates (com.jcabi.github.Coordinates)11 Issue (com.jcabi.github.Issue)10 Repos (com.jcabi.github.Repos)10 References (com.jcabi.github.References)5 Github (com.jcabi.github.Github)3 JsonObject (javax.json.JsonObject)3 Comment (com.jcabi.github.Comment)2 Content (com.jcabi.github.Content)2 Event (com.jcabi.github.Event)2 RepoCommit (com.jcabi.github.RepoCommit)2 ArrayMap (com.jcabi.immutable.ArrayMap)2 Branch (com.jcabi.github.Branch)1 Contents (com.jcabi.github.Contents)1 Fork (com.jcabi.github.Fork)1 IssueLabels (com.jcabi.github.IssueLabels)1 Label (com.jcabi.github.Label)1 Labels (com.jcabi.github.Labels)1 Language (com.jcabi.github.Language)1