def test_user_model_comparison(): user_dict = { 'token': uuid.uuid4().hex, 'email': '*****@*****.**', 'user_type': 'customer', 'name': 'John Doe' } user1 = User.from_dict(user_dict) user2 = User.from_dict(user_dict) assert user1 == user2
def test_user_model_from_dict(): token = uuid.uuid4().hex email = '*****@*****.**' user_type = 'customer' name = 'John Doe' user = User.from_dict({ 'token': token, 'email': email, 'user_type': user_type, 'name': name }) assert user.token == token assert user.email == email assert user.user_type == user_type assert user.name == name
def list(self): return [User.from_dict(i) for i in self.data]
def test_user_repo_list(user_dicts): repo = UserRepo(user_dicts) users = [User.from_dict(i) for i in user_dicts] assert repo.list() == users