예제 #1
0
    def test_unfollow(self):

        user = User(username="******",
                    email="*****@*****.**")

        db.session.add(user)
        
        assert user.get_following().count() == 0

        user2 = User(username="******",
                     email="*****@*****.**")

        db.session.add(user2)

        assert user2.get_followers().count() == 0

        db.session.commit() 

        user.follow(user2)
        
        db.session.commit()

        assert user.get_following().count() == 1
        assert user.get_following().first().id == user2.id

        assert user2.get_followers().count() == 1
        assert user2.get_followers().first().id == user.id

        user.unfollow(user2)

        db.session.commit()

        assert user.get_following().count() == 0
        assert user2.get_followers().count() == 0
예제 #2
0
    def test_unfollow(self):

        user = User(username="******", email="*****@*****.**")

        db.session.add(user)

        assert user.get_following().count() == 0

        user2 = User(username="******", email="*****@*****.**")

        db.session.add(user2)

        assert user2.get_followers().count() == 0

        db.session.commit()

        user.follow(user2)

        db.session.commit()

        assert user.get_following().count() == 1
        assert user.get_following().first().id == user2.id

        assert user2.get_followers().count() == 1
        assert user2.get_followers().first().id == user.id

        user.unfollow(user2)

        db.session.commit()

        assert user.get_following().count() == 0
        assert user2.get_followers().count() == 0
예제 #3
0
    def test_get_followers(self):

        user = User(username="******", email="*****@*****.**")

        db.session.add(user)

        assert user.get_followers().count() == 0

        user2 = User(username="******", email="*****@*****.**")

        db.session.add(user2)

        db.session.commit()

        user.followers = set([user2.id])

        assert user.get_followers().count() == 1
        assert user.get_followers().first().id == user2.id
예제 #4
0
    def test_get_followers(self):

        user = User(username="******",
                    email="*****@*****.**")

        db.session.add(user)
        
        assert user.get_followers().count() == 0

        user2 = User(username="******",
                     email="*****@*****.**")

        db.session.add(user2)

        db.session.commit() 

        user.followers = set([user2.id])

        assert user.get_followers().count() == 1
        assert user.get_followers().first().id == user2.id