Beispiel #1
0
    def test_get_friends_list(self):
        objectFriend = FriendShips()
        objectFriend.dict = {"Przemek": ["Ala", "Basia", "Piotrek"]}
        objectFriend.getFriendsList = MagicMock()
        objectFriend.getFriendsList.return_value = ["Ala", "Basia", "Piotrek"]

        objectStorage = FriendStorage()
        objectStorage.storage = objectFriend
        result = objectStorage.getFriendsList("Przemek")

        self.assertEqual(result, ["Ala", "Basia", "Piotrek"])
class FriendStorage:
    def __init__(self):
        self.storage = FriendShips()

    def makeFriends(self, person1, person2):
        return self.storage.makeFriends(person1, person2)

    def getFriendsList(self, person):
        return self.storage.getFriendsList(person)

    def areFriends(self, person1, person2):
        return self.storage.areFriends(person1, person2)