use of com.google.gerrit.acceptance.RestResponse in project gerrit by GerritCodeReview.
the class ChangeReviewersIT method addSelfAsReviewer.
@Test
public void addSelfAsReviewer() throws Exception {
// Create change owned by admin.
PushOneCommit.Result r = createChange();
// user adds self as REVIEWER.
ReviewInput input = new ReviewInput().reviewer(user.username);
RestResponse resp = userRestSession.post("/changes/" + r.getChangeId() + "/revisions/" + r.getCommit().getName() + "/review", input);
ReviewResult result = readContentFromJson(resp, 200, ReviewResult.class);
assertThat(result.labels).isNull();
assertThat(result.reviewers).isNotNull();
assertThat(result.reviewers).hasSize(1);
// Verify reviewer state.
ChangeInfo c = gApi.changes().id(r.getChangeId()).get();
assertReviewers(c, REVIEWER, user);
assertReviewers(c, CC);
LabelInfo label = c.labels.get("Code-Review");
assertThat(label).isNotNull();
assertThat(label.all).isNotNull();
assertThat(label.all).hasSize(1);
ApprovalInfo approval = label.all.get(0);
assertThat(approval._accountId).isEqualTo(user.getId().get());
}
use of com.google.gerrit.acceptance.RestResponse in project gerrit by GerritCodeReview.
the class CorsIT method preflightOk.
@Test
public void preflightOk() throws Exception {
Result change = createChange();
String origin = "http://example.com";
Request req = Request.Options(adminRestSession.url() + "/a/changes/" + change.getChangeId() + "/detail");
req.addHeader(ORIGIN, origin);
req.addHeader(ACCESS_CONTROL_REQUEST_METHOD, "GET");
req.addHeader(ACCESS_CONTROL_REQUEST_HEADERS, "X-Requested-With");
RestResponse res = adminRestSession.execute(req);
res.assertOK();
checkCors(res, true, origin);
}
use of com.google.gerrit.acceptance.RestResponse in project gerrit by GerritCodeReview.
the class ChangeIdIT method changeNumberReturnsChange.
@Test
public void changeNumberReturnsChange() throws Exception {
PushOneCommit.Result c = createChange();
RestResponse res = adminRestSession.get(changeDetail(getNumericChangeId(c.getChangeId())));
res.assertOK();
}
use of com.google.gerrit.acceptance.RestResponse in project gerrit by GerritCodeReview.
the class ChangeIdIT method projectChangeNumberReturnsChange.
@Test
public void projectChangeNumberReturnsChange() throws Exception {
PushOneCommit.Result c = createChange();
RestResponse res = adminRestSession.get(changeDetail(getProjectChangeNumber(c.getChangeId())));
res.assertOK();
}
use of com.google.gerrit.acceptance.RestResponse in project gerrit by GerritCodeReview.
the class ChangeIdIT method wrongChangeIdReturnsNotFound.
@Test
public void wrongChangeIdReturnsNotFound() throws Exception {
RestResponse res = adminRestSession.get(changeDetail("I1234567890"));
res.assertNotFound();
}
Aggregations