def test_get_user_info(self, db_mock): """get_user_info returns None if user was not found""" repo = Repository() db_instance = db_mock.return_value db_instance.get_user_info.return_value = None self.assertIsNone(repo.get_user_info("123"))
def test_get_user_info_returns_user(self, db_mock): """get_user_info returns user data if user was found""" repo = Repository() db_instance = db_mock.return_value db_instance.get_user_info.return_value = (1, {"name": "Kari"}) self.assertEquals(repo.get_user_info("123"), (1, {"name": "Kari"}))