use of com.google.gerrit.acceptance.PushOneCommit in project gerrit by GerritCodeReview.
the class RobotCommentsIT method setUp.
@Before
public void setUp() throws Exception {
PushOneCommit push = pushFactory.create(db, admin.getIdent(), testRepo, "Provide files which can be used for fixes", ImmutableMap.of(FILE_NAME, FILE_CONTENT, FILE_NAME2, FILE_CONTENT2));
PushOneCommit.Result changeResult = push.to("refs/for/master");
changeId = changeResult.getChangeId();
fixReplacementInfo = createFixReplacementInfo();
fixSuggestionInfo = createFixSuggestionInfo(fixReplacementInfo);
withFixRobotCommentInput = createRobotCommentInput(fixSuggestionInfo);
}
use of com.google.gerrit.acceptance.PushOneCommit in project gerrit by GerritCodeReview.
the class SubmitTypeRuleIT method createChange.
private PushOneCommit.Result createChange(String dest, String subject) throws Exception {
PushOneCommit push = pushFactory.create(db, admin.getIdent(), testRepo, subject, "file" + fileCounter.incrementAndGet(), PushOneCommit.FILE_CONTENT);
PushOneCommit.Result r = push.to("refs/for/" + dest);
r.assertOkStatus();
return r;
}
use of com.google.gerrit.acceptance.PushOneCommit in project gerrit by GerritCodeReview.
the class ChangeEditIT method createEditWithoutPushPatchSetPermission.
@Test
public void createEditWithoutPushPatchSetPermission() throws Exception {
// Create new project with clean permissions
Project.NameKey p = createProject("addPatchSetEdit");
// Clone repository as user
TestRepository<InMemoryRepository> userTestRepo = cloneProject(p, user);
// Block default permission
block(p, "refs/for/*", Permission.ADD_PATCH_SET, REGISTERED_USERS);
// Create change as user
PushOneCommit push = pushFactory.create(db, user.getIdent(), userTestRepo);
PushOneCommit.Result r1 = push.to("refs/for/master");
r1.assertOkStatus();
// Try to create edit as admin
exception.expect(AuthException.class);
createEmptyEditFor(r1.getChangeId());
}
use of com.google.gerrit.acceptance.PushOneCommit in project gerrit by GerritCodeReview.
the class AbstractPushForReview method pushForMasterWithTopicOption.
@Test
public void pushForMasterWithTopicOption() throws Exception {
String topicOption = "topic=myTopic";
List<String> pushOptions = new ArrayList<>();
pushOptions.add(topicOption);
PushOneCommit push = pushFactory.create(db, admin.getIdent(), testRepo);
push.setPushOptions(pushOptions);
PushOneCommit.Result r = push.to("refs/for/master");
r.assertOkStatus();
r.assertChange(Change.Status.NEW, "myTopic");
r.assertPushOptions(pushOptions);
}
use of com.google.gerrit.acceptance.PushOneCommit in project gerrit by GerritCodeReview.
the class AbstractPushForReview method pushNewPatchsetToPatchSetLockedChange.
@Test
public void pushNewPatchsetToPatchSetLockedChange() throws Exception {
PushOneCommit.Result r = pushTo("refs/for/master");
r.assertOkStatus();
PushOneCommit push = pushFactory.create(db, admin.getIdent(), testRepo, PushOneCommit.SUBJECT, "b.txt", "anotherContent", r.getChangeId());
revision(r).review(new ReviewInput().label("Patch-Set-Lock", 1));
r = push.to("refs/for/master");
r.assertErrorStatus("cannot add patch set to " + r.getChange().change().getChangeId() + ". Change is patch set locked.");
}
Aggregations