use of com.nixmash.blog.jpa.model.PostMeta in project nixmash-blog by mintster.
the class AdminPostsControllerTests method multiPhotoPostTwitterCardIsSaved.
@Test
public void multiPhotoPostTwitterCardIsSaved() throws Exception {
mvc.perform(addTwitterCardPostRequest("multiphoto twitter post", TwitterCardType.SUMMARY, PostDisplayType.MULTIPHOTO_POST));
Post post = postService.getPost("my-title-multiphoto-twitter-post");
assertEquals(post.getPostMeta().getTwitterCardType(), TwitterCardType.SUMMARY);
PostMeta postMeta = postService.getPostMetaById(post.getPostId());
assertNotNull(postMeta);
}
use of com.nixmash.blog.jpa.model.PostMeta in project nixmash-blog by mintster.
the class AdminPostsControllerTests method newPostWithTwitterCardTypeNoneIsSaved.
@Test
public void newPostWithTwitterCardTypeNoneIsSaved() throws Exception {
mvc.perform(addTwitterCardPostRequest("notwitter", TwitterCardType.NONE, PostDisplayType.POST));
Post post = postService.getPost("my-title-notwitter");
assertEquals(post.getPostMeta().getTwitterCardType(), TwitterCardType.NONE);
PostMeta postMeta = postService.getPostMetaById(post.getPostId());
assertNotNull(postMeta);
}
use of com.nixmash.blog.jpa.model.PostMeta in project nixmash-blog by mintster.
the class JsoupServiceImpl method updateAllPostMeta.
// endregion
// region TwitterCards
@Override
public void updateAllPostMeta(List<Post> posts) {
for (Post post : posts) {
PostMeta updated = updatePostMeta(PostUtils.postToPostDTO(post));
post.setPostMeta(updated);
}
}
use of com.nixmash.blog.jpa.model.PostMeta in project nixmash-blog by mintster.
the class FmServiceTests method twitterSummaryTemplate.
@Test
public void twitterSummaryTemplate() throws PostNotFoundException {
Post post = postService.getPostById(1L);
PostMeta postMeta = postService.buildTwitterMetaTagsForDisplay(post);
String result = fmService.getTwitterTemplate(postMeta);
assertThat(result, containsString("summary"));
}
use of com.nixmash.blog.jpa.model.PostMeta in project nixmash-blog by mintster.
the class FmServiceTests method noneTwitterTypeTemplateIsNull.
@Test
public void noneTwitterTypeTemplateIsNull() throws PostNotFoundException {
// H2 POST 9L is twitterCardType=NONE
// postService.buildTwitterMetaTagsForDisplay(post) returns NULL PostMeta object
Post post = postService.getPostById(9L);
PostMeta postMeta = postService.buildTwitterMetaTagsForDisplay(post);
assertNull(postMeta);
}
Aggregations