Beispiel #1
0
    def test_deleting_an_article(self, persisted_article):
        command = UserAuthenticationCommand(email='*****@*****.**',
                                            password='******')
        authenticated_user = UserAuthenticationService.authenticate_user(
            command)

        assert ArticleService.get_article(
            GetArticleCommand(slug=persisted_article.slug)) is not None

        command = DeleteArticleCommand(token=authenticated_user['token'],
                                       slug=persisted_article.slug)
        ArticleService.delete_article(command)

        assert ArticleService.get_article(
            GetArticleCommand(slug=persisted_article.slug)) is None
Beispiel #2
0
    def test_that_article_can_be_retrieved_through_the_article_service(
            self, persisted_article, test_domain):
        command = GetArticleCommand(slug=persisted_article.slug)
        article_resource = ArticleService.get_article(command)

        assert article_resource is not None
        assert article_resource['slug'] == persisted_article.slug
Beispiel #3
0
    def test_updating_an_articles_title(self, persisted_article):
        command = UserAuthenticationCommand(email='*****@*****.**',
                                            password='******')
        authenticated_user = UserAuthenticationService.authenticate_user(
            command)

        command = UpdateArticleCommand(
            token=authenticated_user['token'],
            slug=persisted_article.slug,
            title='How to train your dragon - Part 2 - At Worlds End')
        updated_article = ArticleService.update_article(command)
        assert updated_article[
            'slug'] == 'how-to-train-your-dragon-part-2-at-worlds-end'