Example #1
0
 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
Example #2
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)
Example #3
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)
Example #4
0
    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
Example #5
0
 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
Example #6
0
 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
Example #7
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
Example #8
0
    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
Example #9
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',
                       isPublished='True',
                       coverImage="Image")
     article.save()
     assert article.favourite(u1.profile)
     assert article.is_favourite(u1.profile)
Example #10
0
    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)
Example #11
0
    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)
Example #12
0
    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)
Example #13
0
    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
Example #14
0
 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
Example #15
0
 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