Example #1
0
def test_create_article_with_slug():
    art = Article(
        tweet_id=123,
        text="This is a tweet",
        title="This is a unique title",
        body="This is a detailed explanation of the news",
        url="http://clarin.com/url",
        html="algodehtml",
        created_at=datetime.utcnow() - timedelta(days=1),
    )
    comments = [comment(), comment()]

    art.comments = comments

    art.save()

    art = Article.objects.get(tweet_id=123)
    assert art.slug is not None
Example #2
0
def test_create_article():
    art = Article(
        tweet_id=12345,
        text="This is a tweet",
        title="This is a title",
        body="This is a detailed explanation of the news",
        url="http://clarin.com/url",
        html="algodehtml",
        created_at=datetime.utcnow() - timedelta(days=1),
    )
    comments = [comment(), comment()]

    art.comments = comments

    art.save()

    art = Article.objects.get(tweet_id=12345)

    assert len(art.comments) == 2
    assert art.comments[0].text == comments[0].text
    assert art.comments[1].text == comments[1].text