Search in sources :

Example 56 with FakeRequest

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

the class RtReleaseAssetsTest method listReleaseAssets.

/**
 * RtRelease can list assets for a release.
 *
 * @throws Exception If something goes wrong.
 */
@Test
public void listReleaseAssets() throws Exception {
    final ReleaseAssets assets = new RtReleaseAssets(new FakeRequest().withStatus(HttpURLConnection.HTTP_OK).withBody("[{\"id\":1},{\"id\":2}]"), release());
    MatcherAssert.assertThat(assets.iterate(), Matchers.<ReleaseAsset>iterableWithSize(2));
}
Also used : FakeRequest(com.jcabi.http.request.FakeRequest) Test(org.junit.Test)

Example 57 with FakeRequest

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

the class RtSearchTest method canSearchForUsers.

/**
 * RtSearch can search for users.
 *
 * @throws Exception if a problem occurs
 */
@Test
public void canSearchForUsers() throws Exception {
    final String login = "test-user";
    final Search search = new RtGithub(new FakeRequest().withBody(RtSearchTest.search(Json.createObjectBuilder().add("login", login).build()).toString())).search();
    MatcherAssert.assertThat(search.users("test3", "joined", Search.Order.DESC).iterator().next().login(), Matchers.equalTo(login));
}
Also used : FakeRequest(com.jcabi.http.request.FakeRequest) Test(org.junit.Test)

Example 58 with FakeRequest

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

the class RtRepoTest method fetchContents.

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

Example 59 with FakeRequest

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

the class RtRepoTest method fetchesIssues.

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

Example 60 with FakeRequest

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

the class RtRepoTest method fetchHooks.

/**
 * RtRepo can fetch its hooks.
 *
 * @throws Exception if a problem occurs.
 */
@Test
public void fetchHooks() throws Exception {
    final Repo repo = RtRepoTest.repo(new FakeRequest());
    MatcherAssert.assertThat(repo.hooks(), Matchers.notNullValue());
}
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