Package sagan.team

Examples of sagan.team.MemberProfile


        assertThat(html.select("a.author").first().attr("href"), containsString(activeAuthor.getUsername()));
    }

    @Test
    public void blogIndexPostsDoNotIncludeLinksToHiddenAuthors() throws Exception {
        MemberProfile activeAuthor =
                MemberProfileBuilder.profile().name("Hidden Author").username("hidden_author").hidden(true).build();
        teamRepository.save(activeAuthor);

        Post post = new PostBuilder().title("Blog Post ").author(activeAuthor).build();
        postRepository.save(post);
View Full Code Here


        assertThat(html.text(), containsString("Hidden Author"));
    }

    @Test
    public void blogPostPageIncludesLinkToAuthor() throws Exception {
        MemberProfile activeAuthor = MemberProfileBuilder.profile().username("active_author").build();
        teamRepository.save(activeAuthor);

        Post post = new PostBuilder().title("Blog Post ").author(activeAuthor).build();
        postRepository.save(post);

        MvcResult response = mockMvc.perform(get("/blog/" + post.getPublicSlug())).andReturn();
        Document html = Jsoup.parse(response.getResponse().getContentAsString());
        assertThat(html.select("a.author").first().attr("href"), containsString(activeAuthor.getUsername()));
    }
View Full Code Here

        assertThat(html.select("a.author").first().attr("href"), containsString(activeAuthor.getUsername()));
    }

    @Test
    public void blogPostPageDoesNotIncludeLinkToHiddenAuthors() throws Exception {
        MemberProfile activeAuthor =
                MemberProfileBuilder.profile().name("Hidden Author").username("hidden_author").hidden(true).build();
        teamRepository.save(activeAuthor);

        Post post = new PostBuilder().title("Blog Post ").author(activeAuthor).build();
        postRepository.save(post);
View Full Code Here

        assertThat(allPosts.getContent(), containsInAnyOrder(published, scheduled, draft));
    }

    @Test
    public void getPublishedPostsForAuthorOnlyShowsAuthorsPosts() {
        MemberProfile profile = new MemberProfile();
        profile.setUsername("myauthor");

        Post post = PostBuilder.post().author(profile).title(uniqueTitle()).publishAt(yesterday).build();

        postRepository.save(post);
        postRepository.save(PostBuilder.post().title(uniqueTitle()).build());
View Full Code Here

        assertThat(publishedPosts.getContent(), contains(post));
    }

    @Test
    public void getPublishedPostsForAuthorOnlyShowsPublishedPosts() {
        MemberProfile profile = new MemberProfile();
        profile.setUsername("myauthor");

        Post post = PostBuilder.post().author(profile).title(uniqueTitle()).publishAt(yesterday).build();

        postRepository.save(post);
        postRepository.save(PostBuilder.post().title(uniqueTitle()).author(profile).draft().build());
View Full Code Here

        service = new TeamService(teamRepository, searchService, mapper);
    }

    @Test
    public void updateMemberProfileSavesProfileToSearchIndex() {
        MemberProfile savedProfile = new MemberProfile();
        given(teamRepository.findById(1234L)).willReturn(savedProfile);

        SearchEntry searchEntry = new SearchEntry();
        given(mapper.map(savedProfile)).willReturn(searchEntry);
        service.updateMemberProfile(1234L, new MemberProfile());

        verify(searchService).saveToIndex(searchEntry);
    }
View Full Code Here

        verify(searchService).saveToIndex(searchEntry);
    }

    @Test
    public void updateMemberProfileUpdatesAvatarUrlFromGravatarEmail() {
        MemberProfile savedProfile = new MemberProfile();
        given(teamRepository.findById(1234L)).willReturn(savedProfile);

        SearchEntry searchEntry = new SearchEntry();
        given(mapper.map(savedProfile)).willReturn(searchEntry);
        MemberProfile updatedProfile = new MemberProfile();
        updatedProfile.setGravatarEmail("test@example.com");
        service.updateMemberProfile(1234L, updatedProfile);

        assertThat(savedProfile.getGravatarEmail(), equalTo("test@example.com"));
        assertThat(savedProfile.getAvatarUrl(), equalTo("http://gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0"));
    }
View Full Code Here

        assertThat(savedProfile.getAvatarUrl(), equalTo("http://gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0"));
    }

    @Test
    public void updateMemberProfileDoesNotUpdateAvatarUrlIfGravatarEmailIsEmpty() {
        MemberProfile savedProfile = new MemberProfile();
        savedProfile.setAvatarUrl("http://example.com/image.png");
        given(teamRepository.findById(1234L)).willReturn(savedProfile);

        SearchEntry searchEntry = new SearchEntry();
        given(mapper.map(savedProfile)).willReturn(searchEntry);
        MemberProfile updatedProfile = new MemberProfile();
        updatedProfile.setGravatarEmail("");
        service.updateMemberProfile(1234L, updatedProfile);

        assertThat(savedProfile.getAvatarUrl(), equalTo("http://example.com/image.png"));
    }
View Full Code Here

TOP

Related Classes of sagan.team.MemberProfile

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.