Search in sources :

Example 61 with FakeRequest

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

the class RtRepoTest method fetchesPulls.

/**
 * RtRepo can fetch its pulls.
 *
 * @throws Exception if a problem occurs.
 */
@Test
public void fetchesPulls() throws Exception {
    final Repo repo = RtRepoTest.repo(new FakeRequest());
    MatcherAssert.assertThat(repo.pulls(), Matchers.notNullValue());
}
Also used : FakeRequest(com.jcabi.http.request.FakeRequest) Test(org.junit.Test)

Example 62 with FakeRequest

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

the class RtRepoTest method fetchesBranches.

/**
 * RtRepo can fetch its branches.
 *
 * @throws Exception if a problem occurs.
 */
@Test
public void fetchesBranches() throws Exception {
    final Repo repo = RtRepoTest.repo(new FakeRequest());
    MatcherAssert.assertThat(repo.branches(), Matchers.notNullValue());
}
Also used : FakeRequest(com.jcabi.http.request.FakeRequest) Test(org.junit.Test)

Example 63 with FakeRequest

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

the class RtRepoTest method fetchCommits.

/**
 * RtRepo can fetch commits.
 */
@Test
public void fetchCommits() {
    final Repo repo = RtRepoTest.repo(new FakeRequest());
    MatcherAssert.assertThat(repo.commits(), Matchers.notNullValue());
}
Also used : FakeRequest(com.jcabi.http.request.FakeRequest) Test(org.junit.Test)

Example 64 with FakeRequest

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

the class RetryCarefulWireTest method tolerateMissingRateLimitResetHeader.

/**
 * RetryCarefulWire can tolerate the lack the X-RateLimit-Reset header.
 * @throws IOException If some problem inside
 */
@Test
public void tolerateMissingRateLimitResetHeader() throws IOException {
    final int threshold = 8;
    // @checkstyle MagicNumber (1 lines)
    new FakeRequest().withStatus(HttpURLConnection.HTTP_OK).withReason(OK).withHeader(REMAINING_HEADER, "7").through(RetryCarefulWire.class, threshold).fetch();
    MatcherAssert.assertThat("Did not crash when X-RateLimit-Reset header was absent", true);
}
Also used : FakeRequest(com.jcabi.http.request.FakeRequest) Test(org.junit.Test)

Example 65 with FakeRequest

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

the class CarefulWireTest method tolerateMissingRateLimitResetHeader.

/**
 * CarefulWire can tolerate the lack the X-RateLimit-Reset header.
 * @throws IOException If some problem inside
 */
@Test
public void tolerateMissingRateLimitResetHeader() throws IOException {
    final int threshold = 8;
    // @checkstyle MagicNumber (1 lines)
    new FakeRequest().withStatus(HttpURLConnection.HTTP_OK).withReason(OK).withHeader(REMAINING_HEADER, "7").through(CarefulWire.class, threshold).fetch();
    MatcherAssert.assertThat("Did not crash when X-RateLimit-Reset header was absent", true);
}
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