示例#1
0
    def test_get_followers_returns_users_that_follow_by_a_given_user(self):

        user1 = User.objects.create_user("luke", "*****@*****.**",
                                         "skywalker")
        user2 = User.objects.create_user("anakin", "*****@*****.**",
                                         "anakinSky")

        Relationship.objects.create(origin=user1,
                                    target=user2)  #usuario 1 sigue a usuario2

        followers = get_followers(user2)

        self.assertEqual([user1], followers)  # followers == [user1]
    def test_get_followers_returns_users_that_follow_a_given_user(self):

        followers = get_followers(self.user2)

        self.assertEqual([self.user1], followers)  # followers = [user1]