CreateBranch: Test that branches cannot be created with invalid names
This increases the test coverage of the CreateBranch REST endpoint. Signed-off-by: Edwin Kempin <ekempin@google.com> Change-Id: I86e46cf34e49172be2fb15e8970c5dca5aa2dd1f
This commit is contained in:
@@ -336,6 +336,14 @@ public class CreateBranchIT extends AbstractDaemonTest {
|
||||
"not allowed to create branches under \"" + MagicBranch.NEW_CHANGE + "\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cannotCreateBranchWithInvalidName() throws Exception {
|
||||
assertCreateFails(
|
||||
BranchNameKey.create(project, RefNames.REFS_HEADS),
|
||||
BadRequestException.class,
|
||||
"invalid branch name \"" + RefNames.REFS_HEADS + "\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createBranchLeadingSlashesAreRemoved() throws Exception {
|
||||
BranchNameKey expectedNameKey = BranchNameKey.create(project, "test");
|
||||
|
||||
Reference in New Issue
Block a user