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
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
def fetch_article(slug): if not slug: return '', 400 command = GetArticleCommand(slug=slug) article_resource = ArticleService.get_article(command) return jsonify(article_resource), 200