use of com.google.gerrit.extensions.api.projects.ConfigInput in project gerrit by GerritCodeReview.
the class ChangeReviewersByEmailIT method setUp.
@Before
public void setUp() throws Exception {
ConfigInput conf = new ConfigInput();
conf.enableReviewerByEmail = InheritableBoolean.TRUE;
gApi.projects().name(project.get()).config(conf);
}
use of com.google.gerrit.extensions.api.projects.ConfigInput in project gerrit by GerritCodeReview.
the class ProjectIT method setConfig.
@Test
public void setConfig() throws Exception {
ConfigInput input = createTestConfigInput();
ConfigInfo info = gApi.projects().name(project.get()).config(input);
assertThat(info.description).isEqualTo(input.description);
assertThat(info.useContributorAgreements.configuredValue).isEqualTo(input.useContributorAgreements);
assertThat(info.useContentMerge.configuredValue).isEqualTo(input.useContentMerge);
assertThat(info.useSignedOffBy.configuredValue).isEqualTo(input.useSignedOffBy);
assertThat(info.createNewChangeForAllNotInTarget.configuredValue).isEqualTo(input.createNewChangeForAllNotInTarget);
assertThat(info.requireChangeId.configuredValue).isEqualTo(input.requireChangeId);
assertThat(info.rejectImplicitMerges.configuredValue).isEqualTo(input.rejectImplicitMerges);
assertThat(info.enableReviewerByEmail.configuredValue).isEqualTo(input.enableReviewerByEmail);
assertThat(info.createNewChangeForAllNotInTarget.configuredValue).isEqualTo(input.createNewChangeForAllNotInTarget);
assertThat(info.maxObjectSizeLimit.configuredValue).isEqualTo(input.maxObjectSizeLimit);
assertThat(info.submitType).isEqualTo(input.submitType);
assertThat(info.state).isEqualTo(input.state);
}
use of com.google.gerrit.extensions.api.projects.ConfigInput in project gerrit by GerritCodeReview.
the class ProjectIT method nonOwnerCannotSetConfig.
@Test
public void nonOwnerCannotSetConfig() throws Exception {
ConfigInput input = createTestConfigInput();
setApiUser(user);
exception.expect(AuthException.class);
exception.expectMessage("restricted to project owner");
gApi.projects().name(project.get()).config(input);
}
use of com.google.gerrit.extensions.api.projects.ConfigInput in project gerrit by GerritCodeReview.
the class AbstractQueryChangesTest method reviewerAndCcByEmail.
@Test
public void reviewerAndCcByEmail() throws Exception {
assume().that(notesMigration.enabled()).isTrue();
Project.NameKey project = new Project.NameKey("repo");
TestRepository<Repo> repo = createProject(project.get());
ConfigInput conf = new ConfigInput();
conf.enableReviewerByEmail = InheritableBoolean.TRUE;
gApi.projects().name(project.get()).config(conf);
String userByEmail = "un.registered@reviewer.com";
String userByEmailWithName = "John Doe <" + userByEmail + ">";
Change change1 = insert(repo, newChange(repo));
Change change2 = insert(repo, newChange(repo));
insert(repo, newChange(repo));
AddReviewerInput rin = new AddReviewerInput();
rin.reviewer = userByEmailWithName;
rin.state = ReviewerState.REVIEWER;
gApi.changes().id(change1.getId().get()).addReviewer(rin);
rin = new AddReviewerInput();
rin.reviewer = userByEmailWithName;
rin.state = ReviewerState.CC;
gApi.changes().id(change2.getId().get()).addReviewer(rin);
if (getSchemaVersion() >= 41) {
assertQuery("reviewer:\"" + userByEmailWithName + "\"", change1);
assertQuery("cc:\"" + userByEmailWithName + "\"", change2);
// Omitting the name:
assertQuery("reviewer:\"" + userByEmail + "\"", change1);
assertQuery("cc:\"" + userByEmail + "\"", change2);
} else {
assertMissingField(ChangeField.REVIEWER_BY_EMAIL);
assertFailingQuery("reviewer:\"" + userByEmailWithName + "\"", "User " + userByEmailWithName + " not found");
assertFailingQuery("cc:\"" + userByEmailWithName + "\"", "User " + userByEmailWithName + " not found");
// Omitting the name:
assertFailingQuery("reviewer:\"" + userByEmail + "\"", "User " + userByEmail + " not found");
assertFailingQuery("cc:\"" + userByEmail + "\"", "User " + userByEmail + " not found");
}
}
use of com.google.gerrit.extensions.api.projects.ConfigInput in project gerrit by GerritCodeReview.
the class ChangeIT method addReviewerThatIsInactiveEmailFallback.
@Test
public void addReviewerThatIsInactiveEmailFallback() throws Exception {
assume().that(notesMigration.enabled()).isTrue();
ConfigInput conf = new ConfigInput();
conf.enableReviewerByEmail = InheritableBoolean.TRUE;
gApi.projects().name(project.get()).config(conf);
PushOneCommit.Result result = createChange();
String username = "user@domain.com";
gApi.accounts().create(username).setActive(false);
AddReviewerInput in = new AddReviewerInput();
in.reviewer = username;
in.state = ReviewerState.CC;
AddReviewerResult r = gApi.changes().id(result.getChangeId()).addReviewer(in);
assertThat(r.input).isEqualTo(username);
assertThat(r.error).isNull();
// When adding by email, the reviewers field is also empty because we can't
// render a ReviewerInfo object for a non-account.
assertThat(r.reviewers).isNull();
}
Aggregations