GroupsIT: Move createGroup() methods to AbstractDaemonTest
So they can be reused in other tests. Change-Id: I6735111c2c93053873e87c87f0bc43c4ea1b446d
This commit is contained in:
@@ -31,6 +31,7 @@ import com.google.gerrit.common.data.PermissionRule;
|
|||||||
import com.google.gerrit.extensions.api.GerritApi;
|
import com.google.gerrit.extensions.api.GerritApi;
|
||||||
import com.google.gerrit.extensions.api.changes.ReviewInput;
|
import com.google.gerrit.extensions.api.changes.ReviewInput;
|
||||||
import com.google.gerrit.extensions.api.changes.RevisionApi;
|
import com.google.gerrit.extensions.api.changes.RevisionApi;
|
||||||
|
import com.google.gerrit.extensions.api.groups.GroupInput;
|
||||||
import com.google.gerrit.extensions.api.projects.BranchApi;
|
import com.google.gerrit.extensions.api.projects.BranchApi;
|
||||||
import com.google.gerrit.extensions.api.projects.BranchInput;
|
import com.google.gerrit.extensions.api.projects.BranchInput;
|
||||||
import com.google.gerrit.extensions.api.projects.ProjectInput;
|
import com.google.gerrit.extensions.api.projects.ProjectInput;
|
||||||
@@ -746,4 +747,17 @@ public abstract class AbstractDaemonTest {
|
|||||||
assertThat(ctls).hasSize(1);
|
assertThat(ctls).hasSize(1);
|
||||||
return changeResourceFactory.create(ctls.get(0));
|
return changeResourceFactory.create(ctls.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String createGroup(String name) throws Exception {
|
||||||
|
return createGroup(name, "Administrators");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String createGroup(String name, String owner) throws Exception {
|
||||||
|
name = name(name);
|
||||||
|
GroupInput in = new GroupInput();
|
||||||
|
in.name = name;
|
||||||
|
in.ownerId = owner;
|
||||||
|
gApi.groups().create(in);
|
||||||
|
return name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -560,19 +560,6 @@ public class GroupsIT extends AbstractDaemonTest {
|
|||||||
return groupCache.get(new AccountGroup.NameKey(name));
|
return groupCache.get(new AccountGroup.NameKey(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String createGroup(String name) throws Exception {
|
|
||||||
return createGroup(name, "Administrators");
|
|
||||||
}
|
|
||||||
|
|
||||||
private String createGroup(String name, String owner) throws Exception {
|
|
||||||
name = name(name);
|
|
||||||
GroupInput in = new GroupInput();
|
|
||||||
in.name = name;
|
|
||||||
in.ownerId = owner;
|
|
||||||
gApi.groups().create(in);
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String createAccount(String name, String group) throws Exception {
|
private String createAccount(String name, String group) throws Exception {
|
||||||
name = name(name);
|
name = name(name);
|
||||||
accounts.create(name, group);
|
accounts.create(name, group);
|
||||||
|
|||||||
Reference in New Issue
Block a user