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));
}
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"));
}
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());
}
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));
}
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"));
}
Aggregations