Search in sources :

Example 11 with Repo

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

the class MkRepoTest method works.

/**
 * Repo can work.
 * @throws Exception If some problem inside
 */
@Test
public void works() throws Exception {
    final Repos repos = new MkRepos(new MkStorage.InFile(), "jeff");
    final Repo repo = repos.create(new Repos.RepoCreate("test5", false));
    MatcherAssert.assertThat(repo.coordinates(), Matchers.hasToString("jeff/test5"));
}
Also used : Repos(com.jcabi.github.Repos) Repo(com.jcabi.github.Repo) Test(org.junit.Test)

Example 12 with Repo

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

the class MkIssueTest method canRememberItsAuthor.

/**
 * MkIssue can remember it's author.
 * @throws Exception when a problem occurs.
 */
@Test
public void canRememberItsAuthor() throws Exception {
    final MkGithub first = new MkGithub("first");
    final Github second = first.relogin("second");
    final Repo repo = first.randomRepo();
    final int number = second.repos().get(repo.coordinates()).issues().create("", "").number();
    final Issue issue = first.repos().get(repo.coordinates()).issues().get(number);
    MatcherAssert.assertThat(new Issue.Smart(issue).author().login(), Matchers.is("second"));
}
Also used : Issue(com.jcabi.github.Issue) Repo(com.jcabi.github.Repo) Github(com.jcabi.github.Github) Test(org.junit.Test)

Example 13 with Repo

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

the class MkLabelsTest method iteratesLabels.

/**
 * MkLabels can list labels.
 * @throws Exception If some problem inside
 */
@Test
public void iteratesLabels() throws Exception {
    final Repo repo = new MkGithub().randomRepo();
    repo.labels().create("bug", "e0e0e0");
    MatcherAssert.assertThat(repo.labels().iterate(), Matchers.<Label>iterableWithSize(1));
}
Also used : Repo(com.jcabi.github.Repo) Test(org.junit.Test)

Example 14 with Repo

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

the class MkBranchesTest method createsBranch.

/**
 * MkBranches can create a new branch.
 * @throws IOException if there is any I/O problem
 */
@Test
public void createsBranch() throws IOException {
    final String name = "my-new-feature";
    final String sha = "590e188e3d52a8da38cf51d3f9bf598bb46911af";
    final Repo repo = new MkGithub().randomRepo();
    final Branch branch = ((MkBranches) (repo.branches())).create(name, sha);
    MatcherAssert.assertThat(branch.name(), Matchers.equalTo(name));
    MatcherAssert.assertThat(branch.commit().sha(), Matchers.equalTo(sha));
    final Coordinates coords = branch.commit().repo().coordinates();
    MatcherAssert.assertThat(coords.user(), Matchers.equalTo(repo.coordinates().user()));
    MatcherAssert.assertThat(coords.repo(), Matchers.equalTo(repo.coordinates().repo()));
}
Also used : Repo(com.jcabi.github.Repo) Branch(com.jcabi.github.Branch) Coordinates(com.jcabi.github.Coordinates) Test(org.junit.Test)

Example 15 with Repo

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

the class MkContentTest method canGetOwnRepo.

/**
 * MkContent should be able to fetch its own repo.
 *
 * @throws Exception if some problem inside
 */
@Test
public void canGetOwnRepo() throws Exception {
    final Repo repo = new MkGithub().randomRepo();
    final Contents contents = repo.contents();
    final Content content = contents.create(jsonContent("repo.txt", "for repo", "json repo"));
    MatcherAssert.assertThat(content.repo(), Matchers.is(repo));
}
Also used : Contents(com.jcabi.github.Contents) Repo(com.jcabi.github.Repo) Content(com.jcabi.github.Content) 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