use of com.jcabi.http.request.FakeRequest in project jcabi-github by jcabi.
the class RtPublicKeyTest method canObtainUser.
/**
* RtPublicKey can obtain its own user.
*
* @throws Exception if a problem occurs.
*/
@Test
public void canObtainUser() throws Exception {
final User user = Mockito.mock(User.class);
final RtPublicKey key = new RtPublicKey(new FakeRequest(), user, 2);
MatcherAssert.assertThat(key.user(), Matchers.sameInstance(user));
}
use of com.jcabi.http.request.FakeRequest in project jcabi-github by jcabi.
the class RtPublicMembersTest method fetchesOrg.
/**
* RtPublicMembers can fetch its organization.
* @throws IOException If there is an I/O problem
*/
@Test
public void fetchesOrg() throws IOException {
final Organization org = organization();
MatcherAssert.assertThat(new RtPublicMembers(new FakeRequest(), org).org(), Matchers.equalTo(org));
}
use of com.jcabi.http.request.FakeRequest in project jcabi-github by jcabi.
the class RtPullCommentsTest method fetchesPullComment.
/**
* RtPullComments can fetch a single comment.
*
* @throws Exception If something goes wrong.
*/
@Test
public void fetchesPullComment() throws Exception {
final Pull pull = Mockito.mock(Pull.class);
Mockito.doReturn(repo()).when(pull).repo();
final RtPullComments comments = new RtPullComments(new FakeRequest(), pull);
MatcherAssert.assertThat(comments.get(1), Matchers.notNullValue());
}
use of com.jcabi.http.request.FakeRequest in project jcabi-github by jcabi.
the class RtReleaseAssetTest method canObtainOwnRelease.
/**
* RtReleaseAsset can obtain its own release.
* @throws Exception if a problem occurs.
*/
@Test
public void canObtainOwnRelease() throws Exception {
final Release release = release();
final RtReleaseAsset asset = new RtReleaseAsset(new FakeRequest(), release, 1);
MatcherAssert.assertThat(asset.release(), Matchers.is(release));
}
use of com.jcabi.http.request.FakeRequest in project jcabi-github by jcabi.
the class RtReleaseAssetsTest method uploadReleaseAsset.
/**
* RtRelease can upload a release asset.
*
* @throws Exception If something goes wrong
*/
@Test
public void uploadReleaseAsset() throws Exception {
final String body = "{\"id\":1}";
final ReleaseAssets assets = new RtReleaseAssets(new FakeRequest().withStatus(HttpURLConnection.HTTP_CREATED).withBody(body), release());
MatcherAssert.assertThat(assets.upload(body.getBytes(), "text/plain", "hello.txt").number(), Matchers.is(1));
}
Aggregations