Search in sources :

Example 21 with FakeRequest

use of com.jcabi.http.request.FakeRequest in project jcabi-github by jcabi.

the class RtGitTest method canFetchOwnRepo.

/**
 * RtGit can fetch its own repo.
 *
 * @throws Exception If something goes wrong.
 */
@Test
public void canFetchOwnRepo() throws Exception {
    final Repo repo = repo();
    MatcherAssert.assertThat(new RtGit(new FakeRequest(), repo).repo(), Matchers.is(repo));
}
Also used : FakeRequest(com.jcabi.http.request.FakeRequest) Test(org.junit.Test)

Example 22 with FakeRequest

use of com.jcabi.http.request.FakeRequest in project jcabi-github by jcabi.

the class RtGithubTest method equalsToAnotherGithub.

/**
 * RtGithub can compare itself with another object.
 * @throws Exception if a problem occurs.
 */
@Test
public void equalsToAnotherGithub() throws Exception {
    MatcherAssert.assertThat(new RtGithub(new FakeRequest().header("abc", "cde")), Matchers.not(Matchers.equalTo(new RtGithub(new FakeRequest().header("fgh", "ikl")))));
    MatcherAssert.assertThat(new RtGithub(new FakeRequest()), Matchers.equalTo(new RtGithub(new FakeRequest())));
}
Also used : FakeRequest(com.jcabi.http.request.FakeRequest) Test(org.junit.Test)

Example 23 with FakeRequest

use of com.jcabi.http.request.FakeRequest in project jcabi-github by jcabi.

the class RtGithubTest method retrievesGists.

/**
 * RtGithub can retrieve its gists.
 *
 * @throws Exception if a problem occurs.
 */
@Test
public void retrievesGists() throws Exception {
    final RtGithub github = new RtGithub(new FakeRequest());
    MatcherAssert.assertThat(github.gists(), Matchers.notNullValue());
}
Also used : FakeRequest(com.jcabi.http.request.FakeRequest) Test(org.junit.Test)

Example 24 with FakeRequest

use of com.jcabi.http.request.FakeRequest in project jcabi-github by jcabi.

the class RtGitignoresTest method getRawTemplateByName.

/**
 * RtGitignores can get raw template by name.
 * @throws Exception if there is any error
 */
@Test
public void getRawTemplateByName() throws Exception {
    final RtGitignores gitignores = new RtGitignores(new RtGithub(new FakeRequest().withBody("# Object files")));
    MatcherAssert.assertThat(gitignores.template("C#"), Matchers.startsWith("# Object"));
}
Also used : FakeRequest(com.jcabi.http.request.FakeRequest) Test(org.junit.Test)

Example 25 with FakeRequest

use of com.jcabi.http.request.FakeRequest in project jcabi-github by jcabi.

the class RtUserTest method checksIfHeHasNoName.

/**
 * RtUser can check if he has NO name.
 * @throws Exception If some problem inside
 */
@Test
public void checksIfHeHasNoName() throws Exception {
    final User.Smart smart = new User.Smart(new RtUser(Mockito.mock(Github.class), new FakeRequest().withBody(Json.createObjectBuilder().build().toString()), "octoc"));
    MatcherAssert.assertThat(smart.hasName(), Matchers.equalTo(false));
}
Also used : FakeRequest(com.jcabi.http.request.FakeRequest) Test(org.junit.Test)

Aggregations

FakeRequest (com.jcabi.http.request.FakeRequest)65 Test (org.junit.Test)65 MkGithub (com.jcabi.github.mock.MkGithub)9 JsonObject (javax.json.JsonObject)3 Request (com.jcabi.http.Request)2 ApacheRequest (com.jcabi.http.request.ApacheRequest)2 MkOrganization (com.jcabi.github.mock.MkOrganization)1 Response (com.jcabi.http.Response)1 MkContainer (com.jcabi.http.mock.MkContainer)1 MkGrizzlyContainer (com.jcabi.http.mock.MkGrizzlyContainer)1 JsonResponse (com.jcabi.http.response.JsonResponse)1