Search in sources :

Example 21 with Repo

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

the class MkReferencesTest method iteratesTags.

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

Example 22 with Repo

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

the class MkReposTest method createsRepositoryWithDetails.

/**
 * MkRepos can create a repo with details.
 * @throws Exception If some problem inside
 */
@Test
public void createsRepositoryWithDetails() throws Exception {
    final Repos repos = new MkRepos(new MkStorage.InFile(), "jeff");
    final Repo repo = MkReposTest.repo(repos, "hello", "my test repo");
    MatcherAssert.assertThat(new Repo.Smart(repo).description(), Matchers.startsWith("my test"));
}
Also used : Repos(com.jcabi.github.Repos) Repo(com.jcabi.github.Repo) Test(org.junit.Test)

Example 23 with Repo

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

the class MkReposTest method removesRepo.

/**
 * MkRepos can remove an existing repo.
 * @throws Exception If some problem inside
 */
@Test
public void removesRepo() throws Exception {
    final Repos repos = new MkRepos(new MkStorage.InFile(), "jeff");
    final Repo repo = MkReposTest.repo(repos, "remove-me", "remove repo");
    MatcherAssert.assertThat(repos.get(repo.coordinates()), Matchers.notNullValue());
    repos.remove(repo.coordinates());
    this.thrown.expect(IllegalArgumentException.class);
    this.thrown.expectMessage("repository jeff/remove-me doesn't exist");
    repos.get(repo.coordinates());
}
Also used : Repos(com.jcabi.github.Repos) Repo(com.jcabi.github.Repo) Test(org.junit.Test)

Example 24 with Repo

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

the class MkContentsTest method canIterate.

/**
 * Tests if MkContents is iterable by path.
 * @throws IOException if any error occurs.
 */
@Test
public void canIterate() throws IOException {
    final MkStorage storage = new MkStorage.InFile();
    final Repo repo = repo(storage);
    final Content[] correct = this.addContent(repo, "foo/bar/1", "foo/bar/2");
    this.addContent(repo, "foo/baz", "foo/boo");
    MatcherAssert.assertThat(repo.contents().iterate("foo/bar", "ref-1"), Matchers.contains(correct));
}
Also used : Repo(com.jcabi.github.Repo) Content(com.jcabi.github.Content) Test(org.junit.Test)

Example 25 with Repo

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

the class MkContentsTest method canRemoveFile.

/**
 * MkContents should be able to create new files.
 *
 * @throws Exception if some problem inside
 */
@Test
public void canRemoveFile() throws Exception {
    final Repo repo = new MkGithub().randomRepo();
    final String path = "removeme.txt";
    this.createFile(repo, path);
    final JsonObject json = MkContentsTest.content(path, "theDeleteMessage").add("committer", MkContentsTest.committer()).build();
    final RepoCommit commit = repo.contents().remove(json);
    MatcherAssert.assertThat(commit, Matchers.notNullValue());
    MatcherAssert.assertThat(commit.json().getString("message"), Matchers.equalTo("theDeleteMessage"));
}
Also used : Repo(com.jcabi.github.Repo) RepoCommit(com.jcabi.github.RepoCommit) JsonObject(javax.json.JsonObject) 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