diff --git a/tests/test_repo.py b/tests/test_repo.py index 0888cb3..33b7183 100644 --- a/tests/test_repo.py +++ b/tests/test_repo.py @@ -207,7 +207,7 @@ def test__get_github_client(self): self.assertIsNotNone(repo.get_github_client()) self.assertEqual(repo.get_github_client(), self.mock_git) - def test_get_repo_contents(self): + def test_get_repo_contents_timeout_error(self): self.repo._set_target_branch('target') self.repo.files = [] self.repo._source_repo = MagicMock() @@ -215,3 +215,14 @@ def test_get_repo_contents(self): with pytest.raises(Exception) as context: self.repo._get_repo_contents(path='test/afile.txt') assert "Read Timeout" in str(context.value) + self.repo._source_repo.get_contents.assert_has_calls([call('test/afile.txt', 'target'), call('test/afile.txt', 'target'), call('test/afile.txt', 'target')]) + + + def test_get_repo_contents(self): + self.repo._set_target_branch('target') + self.repo.files = [] + self.repo._source_repo = MagicMock() + repository_file = MagicMock(path='test/afile.txt', type='not_dir') + self.repo._source_repo.get_contents.side_effect = [repository_file] + self.repo._get_repo_contents(path='test/afile.txt') + self.repo._source_repo.get_contents.assert_has_calls([call('test/afile.txt', 'target')])