use of com.jcabi.github.Repo in project jcabi-github by jcabi.
the class MkIssueLabelsTest method addingLabelGeneratesEvent.
/**
* MkIssueLabels creates a "labeled" event when a label is added.
* @throws Exception If some problem inside
*/
@Test
public void addingLabelGeneratesEvent() throws Exception {
final Repo repo = new MkGithub().randomRepo();
final String name = "confirmed";
repo.labels().create(name, "663399");
final Issue issue = repo.issues().create("Titular", "Corpus");
issue.labels().add(Collections.singletonList(name));
MatcherAssert.assertThat(issue.events(), Matchers.<Event>iterableWithSize(1));
final Event.Smart labeled = new Event.Smart(issue.events().iterator().next());
MatcherAssert.assertThat(labeled.type(), Matchers.equalTo(Event.LABELED));
MatcherAssert.assertThat(labeled.author().login(), Matchers.equalTo(USER));
MatcherAssert.assertThat(labeled.repo(), Matchers.equalTo(repo));
MatcherAssert.assertThat(labeled.label().get().name(), Matchers.equalTo(name));
}
use of com.jcabi.github.Repo in project jcabi-github by jcabi.
the class MkIssueLabelsTest method createsLabelsThroughDecorator.
/**
* MkIssueLabels can create labels through Smart decorator.
* @throws Exception If some problem inside
*/
@Test
public void createsLabelsThroughDecorator() throws Exception {
final Repo repo = new MkGithub().randomRepo();
final Issue issue = repo.issues().create("how are you?", "");
final String name = "task";
new IssueLabels.Smart(issue.labels()).addIfAbsent(name, "f0f0f0");
MatcherAssert.assertThat(issue.labels().iterate(), Matchers.<Label>iterableWithSize(1));
}
use of com.jcabi.github.Repo in project jcabi-github by jcabi.
the class MkMilestonesTest method returnsRepo.
/**
* This tests that MkMilestones can return its owner repo.
* @throws Exception - if something goes wrong.
*/
@Test
public void returnsRepo() throws Exception {
final Repo repo = new MkGithub().randomRepo();
final Repo owner = repo.milestones().repo();
MatcherAssert.assertThat(repo, Matchers.is(owner));
}
use of com.jcabi.github.Repo in project jcabi-github by jcabi.
the class MkReferencesTest method removesReference.
/**
* MkReferences can remove a Reference.
* @throws Exception - If something goes wrong.
*/
@Test
public void removesReference() throws Exception {
final Repo owner = new MkGithub().randomRepo();
final References refs = owner.git().references();
refs.create("refs/heads/testbr", "qweqwe22");
refs.create("refs/tags/t2", "111teee");
MatcherAssert.assertThat(refs.iterate(), Matchers.<Reference>iterableWithSize(2));
refs.remove("refs/tags/t2");
MatcherAssert.assertThat(refs.iterate(), Matchers.<Reference>iterableWithSize(1));
}
use of com.jcabi.github.Repo in project jcabi-github by jcabi.
the class MkReferencesTest method iteratesReferences.
/**
* MkReferences can iterate over references.
* @throws Exception - If something goes wrong.
*/
@Test
public void iteratesReferences() 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(), Matchers.<Reference>iterableWithSize(2));
}
Aggregations