Beispiel #1
0
    def test_get_by_id(self):
        """Get user by ID."""
        user = User('foo', '*****@*****.**')
        user.save()

        retrieved = User.get_by_id(user.id)
        assert retrieved == user
Beispiel #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)
Beispiel #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)
Beispiel #4
0
 def test_follow_user(self):
     u1 = User('foo', '*****@*****.**')
     u1.save()
     u2 = User('foo1', '*****@*****.**')
     u2.save()
     p1 = UserProfile(u1)
     p2 = UserProfile(u2)
     p1.save()
     p2.save()
     p1.follow(p2)
     assert p1.is_following(p2)
Beispiel #5
0
 def test_unfollow_user(self):
     u1 = User("foo", "*****@*****.**")
     u1.save()
     u2 = User("foo1", "*****@*****.**")
     u2.save()
     p1 = UserProfile(u1)
     p2 = UserProfile(u2)
     p1.save()
     p2.save()
     p1.follow(p2)
     assert p1.is_following(p2)
     p1.unfollow(p2)
     assert not p1.is_following(p2)
Beispiel #6
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)
Beispiel #7
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)
Beispiel #8
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)
Beispiel #9
0
 def test_unfollow_self(self):
     u1 = User('foo', '*****@*****.**')
     u1.save()
     p1 = UserProfile(u1)
     assert not p1.unfollow(p1)
Beispiel #10
0
 def test_password_is_nullable(self):
     """Test null password."""
     user = User(username='******', email='*****@*****.**')
     user.save()
     assert user.password is None
Beispiel #11
0
 def test_created_at_defaults_to_datetime(self):
     """Test creation date."""
     user = User(username='******', email='*****@*****.**')
     user.save()
     assert bool(user.created_at)
     assert isinstance(user.created_at, dt.datetime)
Beispiel #12
0
 def test_follow_self(self):
     u1 = User("foo", "*****@*****.**")
     u1.save()
     p1 = UserProfile(u1)
     p1.save()
     assert not p1.follow(p1)