示例#1
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
示例#2
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
示例#3
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
示例#4
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)
示例#5
0
文件: test_models.py 项目: rahulwa/ji
    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
示例#6
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
示例#7
0
文件: test_models.py 项目: rahulwa/ji
 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)
示例#8
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)
示例#9
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
示例#10
0
文件: test_models.py 项目: rahulwa/ji
 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
示例#11
0
文件: test_models.py 项目: rahulwa/ji
    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)
示例#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)
示例#13
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)
示例#14
0
文件: test_models.py 项目: rahulwa/ji
 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
示例#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