Exemple #1
0
 def test_removed_post_is_not_returned(self):
     author = get_user('us-ignite')
     publication_date = timezone.now() - relativedelta(days=1)
     post = fixtures.get_post(
         author=author, status=Post.REMOVED,
         publication_date=publication_date)
     eq_(list(Post.published.all()), [])
Exemple #2
0
 def test_get_absolute_url_double_digit_month(self):
     author = get_user('us-ignite')
     naive = datetime(2012, 10, 3, 1, 30)
     publication_date = naive.replace(tzinfo=timezone.utc)
     post = fixtures.get_post(
         author=author, publication_date=publication_date, slug='gigabit-a')
     eq_(post.get_absolute_url(), '/blog/2012/10/gigabit-a/')
Exemple #3
0
 def test_post_attachment_is_created_successfully(self):
     author = get_user('us-ignite')
     post = fixtures.get_post(author=author, status=Post.PUBLISHED)
     data = {
         'post': post,
         'title': 'Gigabit post',
     }
     instance = PostAttachment.objects.create(**data)
     ok_(instance.id)
     eq_(instance.post, post)
     eq_(instance.title, 'Gigabit post')
     eq_(instance.wp_id, '')
     eq_(instance.slug, '')
     eq_(instance.url, '')
     eq_(instance.attachment, '')
     eq_(instance.mime_type, '')
     eq_(instance.description, '')
     eq_(instance.caption, '')
Exemple #4
0
 def test_is_visible_by_author(self):
     author = get_user('us-ignite')
     post = fixtures.get_post(author=author, status=Post.DRAFT)
     eq_(post.is_visible_by(author), True)
Exemple #5
0
 def test_is_not_visible_by_anon(self):
     author = get_user('us-ignite')
     post = fixtures.get_post(author=author, status=Post.DRAFT)
     eq_(post.is_visible_by(utils.get_anon_mock()), False)
Exemple #6
0
 def test_is_visible_by_anon_user(self):
     author = get_user('us-ignite')
     post = fixtures.get_post(author=author, status=Post.PUBLISHED)
     eq_(post.is_visible_by(utils.get_anon_mock()), True)
Exemple #7
0
 def test_user_is_author(self):
     author = get_user('us-ignite')
     post = fixtures.get_post(author=author)
     eq_(post.is_author(author), True)
Exemple #8
0
 def test_post_is_published(self):
     author = get_user('us-ignite')
     post = fixtures.get_post(author=author, status=Post.PUBLISHED)
     eq_(post.is_published(), True)