use of com.github.sdorra.shiro.SubjectAware in project scm-review-plugin by scm-manager.
the class RepositoryLinkEnricherTest method shouldNotEnrichRepositoriesWithoutBranchSupport.
@Test
@SubjectAware(username = "dent", password = "secret")
public void shouldNotEnrichRepositoriesWithoutBranchSupport() {
enricher = new RepositoryLinkEnricher(scmPathInfoStoreProvider, pullRequestService, configService, globalEngineConfigurator);
when(pullRequestService.supportsPullRequests(any())).thenReturn(false);
Repository repo = new Repository("id", "type", "space", "name");
HalEnricherContext context = HalEnricherContext.of(repo);
enricher.enrich(context, appender);
verify(appender, never()).appendLink(any(), any());
}
use of com.github.sdorra.shiro.SubjectAware in project scm-review-plugin by scm-manager.
the class RepositoryLinkEnricherTest method shouldEnrichRepositoriesWithBranchSupport.
@Test
@SubjectAware(username = "dent", password = "secret")
public void shouldEnrichRepositoriesWithBranchSupport() {
enricher = new RepositoryLinkEnricher(scmPathInfoStoreProvider, pullRequestService, configService, globalEngineConfigurator);
when(pullRequestService.supportsPullRequests(any())).thenReturn(true);
mockGlobalConfig(false);
Repository repo = new Repository("id", "type", "space", "name");
HalEnricherContext context = HalEnricherContext.of(repo);
enricher.enrich(context, appender);
verify(appender).appendLink("pullRequest", "https://scm-manager.org/scm/api/v2/pull-requests/space/name");
verify(appender).appendLink("pullRequestConfig", "https://scm-manager.org/scm/api/v2/pull-requests/space/name/config");
}
use of com.github.sdorra.shiro.SubjectAware in project scm-review-plugin by scm-manager.
the class CommentServiceTest method shouldNotMarkAlreadyOutdatedComments.
@Test
@SubjectAware(username = "dent")
public void shouldNotMarkAlreadyOutdatedComments() {
Comment comment = EXISTING_COMMENT.clone();
comment.setOutdated(true);
when(store.getAll(PULL_REQUEST_ID)).thenReturn(singletonList(comment));
commentService.markAsOutdated(NAMESPACE, NAME, PULL_REQUEST_ID, comment.getId());
verify(store, never()).update(any(), any());
}
use of com.github.sdorra.shiro.SubjectAware in project scm-review-plugin by scm-manager.
the class CommentServiceTest method shouldFailIfUserHasNoPermissionTocreateReply.
@Test(expected = UnauthorizedException.class)
@SubjectAware(username = "trillian")
public void shouldFailIfUserHasNoPermissionTocreateReply() {
Reply reply = createReply("1", "1. comment", author);
commentService.reply(NAMESPACE, NAME, PULL_REQUEST_ID, "1", reply);
}
use of com.github.sdorra.shiro.SubjectAware in project scm-review-plugin by scm-manager.
the class CommentServiceTest method shouldFailModifyingRootCommentWhenUserHasNoPermission.
@Test(expected = UnauthorizedException.class)
@SubjectAware(username = "createCommentUser")
public void shouldFailModifyingRootCommentWhenUserHasNoPermission() {
Comment changedRootComment = EXISTING_COMMENT.clone();
commentService.modifyComment(NAMESPACE, NAME, PULL_REQUEST_ID, EXISTING_COMMENT.getId(), changedRootComment);
}
Aggregations