Package org.sonar.server.user

Examples of org.sonar.server.user.UserSession


    }
  }

  @Test
  public void should_not_find_by_id_if_not_logged() {
    UserSession userSession = MockUserSession.create().setLogin(null);
    try {
      service.find(1L, userSession);
      fail();
    } catch (Exception e) {
      assertThat(e).isInstanceOf(UnauthorizedException.class).hasMessage("User is not logged in");
View Full Code Here


    assertThat(issueFilter.get(0).id()).isEqualTo(1L);
  }

  @Test
  public void should_not_find_by_user_if_not_logged() {
    UserSession userSession = MockUserSession.create().setLogin(null);
    try {
      service.findByUser(userSession);
      fail();
    } catch (Exception e) {
      assertThat(e).isInstanceOf(UnauthorizedException.class).hasMessage("User is not logged in");
View Full Code Here

    verify(issueFilterFavouriteDao).insert(any(IssueFilterFavouriteDto.class));
  }

  @Test
  public void should_not_save_if_not_logged() {
    UserSession userSession = MockUserSession.create().setLogin(null);
    try {
      DefaultIssueFilter issueFilter = new DefaultIssueFilter().setName("My Issue");
      service.save(issueFilter, userSession);
      fail();
    } catch (Exception e) {
View Full Code Here

    assertThat(results).hasSize(1);
  }

  @Test
  public void should_not_find_favourite_issue_filter_if_not_logged() {
    UserSession userSession = MockUserSession.create().setLogin(null);

    try {
      service.findFavoriteFilters(userSession);
      fail();
    } catch (Exception e) {
View Full Code Here

  }

  @Test
  public void user_can_share_filter_if_logged_and_own_sharing_permission() {
    when(authorizationDao.selectGlobalPermissions("john")).thenReturn(newArrayList(GlobalPermissions.DASHBOARD_SHARING));
    UserSession userSession = MockUserSession.create().setLogin("john");
    assertThat(service.canShareFilter(userSession)).isTrue();

    userSession = MockUserSession.create().setLogin(null);
    assertThat(service.canShareFilter(userSession)).isFalse();
View Full Code Here

TOP

Related Classes of org.sonar.server.user.UserSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.