def setUp(self): mock_github_conector = MagicMock() mock_github_conector.read_all = MagicMock(return_value=[{"name": "scikit-aero", 'forks_count': '2', 'watchers_count': '3', 'stargazers_count': '3'}]) self.repo = ProjectRepositoryService(mock_github_conector)
class TestProjectRepositoryService(unittest.TestCase): def setUp(self): mock_github_conector = MagicMock() mock_github_conector.read_all = MagicMock(return_value=[{"name": "scikit-aero", 'forks_count': '2', 'watchers_count': '3', 'stargazers_count': '3'}]) self.repo = ProjectRepositoryService(mock_github_conector) def test_when_requesting_sckiti_aero_return_project_(self): project = self.repo.find("Pybonacci", "scikit-aero") self.assertEquals(project.forks, 2) self.assertEquals(project.stars, 3) self.assertEquals(project.watchs, 3)