Пример #1
0
 def test_existing_custom_post_is_ignored(self, mock_get, mock_author):
     post_double = Post(id=12, is_custom=True)
     mock_get.return_value = post_double
     data = _get_post_data(id=10)
     post = consumer.import_post(data)
     mock_get.assert_called_once_with(wp_id__exact=10)
     eq_(post, post_double)
     eq_(mock_author.call_count, 0)
Пример #2
0
 def test_post_is_imported_correctly(self, mock_get, mock_save):
     user = User(username='******', id=2)
     mock_get.return_value = user
     data = _get_post_data()
     post = consumer.import_post(data)
     mock_save.assert_called_once_with()
     eq_(post.wp_id, 23)
     eq_(post.wp_url, 'http://us-ignite.org/')
     eq_(post.author, user)
     eq_(post.wp_type, 'post')
     eq_(post.title, 'Gigabit Post')
     eq_(post.content, 'Content')
     eq_(post.content_html, 'Content')
     eq_(post.excerpt, 'Excerpt')
     eq_(post.excerpt_html, 'Excerpt')
     ok_(post.publication_date)
     ok_(post.update_date)