use of com.nixmash.blog.jpa.model.Post in project nixmash-blog by mintster.
the class AdminPostsControllerTests method updatedPostContainsNewCategory.
@Test
public void updatedPostContainsNewCategory() throws Exception {
Post post = postService.getPostById(1L);
post.setCategory(PostTestUtils.getUncategorizedCategory());
assert (post.getCategory().getCategoryId().equals(1L));
RequestBuilder request = post("/admin/posts/update").param("postId", "1").param("displayType", String.valueOf(post.getDisplayType())).param("postContent", post.getPostContent()).param("postTitle", post.getPostTitle()).param("twitterCardType", post.getPostMeta().getTwitterCardType().name()).param("tags", "one, two").param("categoryId", "3").with(csrf());
mvc.perform(request);
post = postService.getPostById(1L);
assert (post.getCategory().getCategoryId().equals(3L));
}
use of com.nixmash.blog.jpa.model.Post in project nixmash-blog by mintster.
the class AdminPostsControllerTests method newPostContainsTwitterCardInfo.
// endregion
// region Post MetaData
@Test
public void newPostContainsTwitterCardInfo() throws Exception {
mvc.perform(addTwitterCardPostRequest("bigtwitter", TwitterCardType.SUMMARY_LARGE_IMAGE, PostDisplayType.POST));
Post post = postService.getPost("my-title-bigtwitter");
assertEquals(post.getPostMeta().getTwitterCardType(), TwitterCardType.SUMMARY_LARGE_IMAGE);
PostMeta postMeta = postService.getPostMetaById(post.getPostId());
assertNotNull(postMeta);
}
use of com.nixmash.blog.jpa.model.Post in project nixmash-blog by mintster.
the class FmServiceTests method rssPostDisplayTypeContentTest.
// endregion
// region Rss Content Tests
@Test
public void rssPostDisplayTypeContentTest() throws PostNotFoundException {
// H2 POST 10L 'solr-rama' normal POST PostDisplayType
Post post = postService.getPost("solr-rama");
String result = fmService.createRssPostContent(post);
assertThat(result, containsString("<strong>This is a post</strong>"));
}
use of com.nixmash.blog.jpa.model.Post in project nixmash-blog by mintster.
the class FmServiceTests method twitterSummaryLargeImageTemplate.
@Test
public void twitterSummaryLargeImageTemplate() throws PostNotFoundException {
// H2 Post 10L SolrRama is SUMMARY_LARGE_IMAGE
Post post = postService.getPostById(10L);
PostMeta postMeta = postService.buildTwitterMetaTagsForDisplay(post);
String result = fmService.getTwitterTemplate(postMeta);
assertThat(result, containsString("summary_large_image"));
}
use of com.nixmash.blog.jpa.model.Post in project nixmash-blog by mintster.
the class FmServiceTests method rssSinglePhotoPostDisplayTypeContentTest.
@Test
public void rssSinglePhotoPostDisplayTypeContentTest() throws PostNotFoundException {
// H2 POST 11L 'singlephoto-post' SINGLEPHOTO_POST PostDisplayType
Post post = postService.getPost("singlephoto-post");
String result = fmService.createRssPostContent(post);
assertThat(result, containsString("src=\"http://"));
}
Aggregations