def test_remove_tag(self, user): user = user.get() article = Article(user.profile, 'title', 'some body', description='some', isPublished='True') article.save() t1 = Tags(tagname='flask') assert article.add_tag(t1) assert article.remove_tag(t1) assert len(article.tagList) == 0
def test_favorite_an_article(self): u1 = User('foo', '*****@*****.**') u1.save() p1 = UserProfile(u1) p1.save() article = Article(p1, 'title', 'some body', description='some') article.save() assert article.favourite(u1.profile) assert article.is_favourite(u1.profile)
def test_favorite_an_article(self): u1 = User("foo", "*****@*****.**") u1.save() p1 = UserProfile(u1) p1.save() article = Article(p1, "title", "some body", description="some") article.save() assert article.favourite(u1.profile) assert article.is_favourite(u1.profile)
def test_make_comment(self, user): user = user.get() article = Article(user.profile, 'title', 'some body', description='some', isPublished='True') article.save() comment = Comment(article, user.profile, 'some body') comment.save() assert comment.article == article assert comment.author == user.profile
def test_create_article(self, user): u1 = user.get() article = Article(u1.profile, 'title', 'some body', description='some', isPublished='True', coverImage="Image") article.save() assert article.author.user == u1
def test_remove_tag(self, user): user = user.get() article = Article(user.profile, "title", "some body", description="some") article.save() t1 = Tags(tagname="flask") assert article.add_tag(t1) assert article.remove_tag(t1) assert len(article.tagList) == 0
def test_add_tag(self, user): user = user.get() article = Article(user.profile, 'title', 'some body', description='some') article.save() t = Tags(tagname='python') t1 = Tags(tagname='flask') assert article.add_tag(t) assert article.add_tag(t1) assert len(article.tagList) == 2
def test_make_comment(self, user): user = user.get() article = Article(user.profile, "title", "some body", description="some") article.save() comment = Comment(article, user.profile, "some body") comment.save() assert comment.article == article assert comment.author == user.profile
def test_favorite_an_article(self): u1 = User('foo', '*****@*****.**') u1.save() p1 = UserProfile(u1) p1.save() article = Article(p1, 'title', 'some body', description='some', isPublished='True', coverImage="Image") article.save() assert article.favourite(u1.profile) assert article.is_favourite(u1.profile)
def test_request_review(self, user): user = user.get() organization = Organization(name="Name_of_organization", description="Description_of_organization", slug="Slug_of_organization") organization.save() article = Article(user.profile, 'title', 'some body', description='some', isPublished='True', coverImage="Image") article.save() return organization.request_review(article)
def test_unfavorite_an_article(self): u1 = User('foo', '*****@*****.**') u1.save() p1 = UserProfile(u1) p1.save() u2 = User('foo1', '*****@*****.**') u2.save() p2 = UserProfile(u2) p2.save() article = Article(p1, 'title', 'some body', description='some') article.save() assert article.favourite(p1) assert article.unfavourite(p1) assert not article.is_favourite(p1)
def test_unfavorite_an_article(self): u1 = User("foo", "*****@*****.**") u1.save() p1 = UserProfile(u1) p1.save() u2 = User("foo1", "*****@*****.**") u2.save() p2 = UserProfile(u2) p2.save() article = Article(p1, "title", "some body", description="some") article.save() assert article.favourite(p1) assert article.unfavourite(p1) assert not article.is_favourite(p1)
def test_make_comments(self, user): user = user.get() article = Article(user.profile, 'title', 'some body', description='some') article.save() comment = Comment(article, user.profile, 'some body') comment1 = Comment(article, user.profile, 'some body2') comment.save() comment1.save() assert comment.article == article assert comment.author == user.profile assert comment1.article == article assert comment1.author == user.profile assert len(article.comments.all()) == 2
def test_create_article(self, user): u1 = user.get() article = Article(u1.profile, 'title', 'some body', description='some') article.save() assert article.author.user == u1
def test_create_article(self, user): u1 = user.get() article = Article(u1.profile, "title", "some body", description="some") article.save() assert article.author.user == u1