use of sonia.scm.repository.NamespaceAndName in project scm-review-plugin by scm-manager.
the class MergeServiceTest method shouldNotEmergencyMergeWithoutPermission.
@Test
void shouldNotEmergencyMergeWithoutPermission() {
doThrow(UnauthorizedException.class).when(subject).checkPermission("repository:performEmergencyMerge:" + REPOSITORY.getId());
mockPullRequest("squash", "master", "1");
MergeCommitDto mergeCommit = createMergeCommit(false);
NamespaceAndName namespaceAndName = REPOSITORY.getNamespaceAndName();
assertThrows(UnauthorizedException.class, () -> service.merge(namespaceAndName, "1", mergeCommit, MergeStrategy.SQUASH, true));
}
use of sonia.scm.repository.NamespaceAndName in project scm-review-plugin by scm-manager.
the class MergeServiceTest method shouldThrowExceptionWhenPullRequestIsNotOpen.
@Test
void shouldThrowExceptionWhenPullRequestIsNotOpen() {
lenient().when(mergeCommandBuilder.isSupported(MergeStrategy.SQUASH)).thenReturn(true);
mockPullRequest("squash", "master", "1", REJECTED);
MergeCommitDto mergeCommit = createMergeCommit(false);
NamespaceAndName namespaceAndName = REPOSITORY.getNamespaceAndName();
assertThrows(CannotMergeNotOpenPullRequestException.class, () -> service.merge(namespaceAndName, "1", mergeCommit, MergeStrategy.SQUASH, false));
}
use of sonia.scm.repository.NamespaceAndName in project scm-review-plugin by scm-manager.
the class MergeServiceTest method shouldThrowExceptionIfObstacleExists.
@Test
void shouldThrowExceptionIfObstacleExists() {
PullRequest pullRequest = mockPullRequest("squash", "master", "1");
mockMergeGuard(pullRequest, false);
MergeCommitDto mergeCommit = createMergeCommit(false);
NamespaceAndName namespaceAndName = REPOSITORY.getNamespaceAndName();
assertThrows(MergeNotAllowedException.class, () -> service.merge(namespaceAndName, "1", mergeCommit, MergeStrategy.SQUASH, false));
}
use of sonia.scm.repository.NamespaceAndName in project scm-review-plugin by scm-manager.
the class MergeServiceTest method shouldNotMergeWithoutPermission.
@Test
void shouldNotMergeWithoutPermission() {
doThrow(UnauthorizedException.class).when(subject).checkPermission("repository:mergePullRequest:" + REPOSITORY.getId());
mockPullRequest("squash", "master", "1");
MergeCommitDto mergeCommit = createMergeCommit(false);
NamespaceAndName namespaceAndName = REPOSITORY.getNamespaceAndName();
assertThrows(UnauthorizedException.class, () -> service.merge(namespaceAndName, "1", mergeCommit, MergeStrategy.SQUASH, false));
}
use of sonia.scm.repository.NamespaceAndName in project scm-review-plugin by scm-manager.
the class RepositoryEngineConfigResourceTest method initRepositoryManager.
@BeforeEach
void initRepositoryManager() {
lenient().doReturn(REPOSITORY).when(repositoryManager).get(new NamespaceAndName("space", "X"));
lenient().doReturn(null).when(repositoryManager).get(new NamespaceAndName("unknown", "repository"));
}
Aggregations