def test__are_files_in_repo__should_return_false_on_any_missing_file(self):
github_client: github.Github = mock(spec=github.Github, strict=True)
github_repo: github.Repository.Repository = mock(spec=github.Repository.Repository, strict=True)
github_controller = GithubController(github_client, mock(), mock(), mock())
hook_details = mock({'repository': 'repo', 'sha': '123qwe', 'branch': 'master'}, spec=HookDetails, strict=True)
files = ['app/main.py', '.gitignore']
expect(github_client).get_repo('repo').thenReturn(github_repo)
expect(github_repo).get_file_contents(path='app/main.py', ref='123qwe').thenReturn(None)
expect(github_repo).get_file_contents(path='.gitignore', ref='123qwe').thenRaise(GithubException(404, 'File not found'))
assert not await github_controller.are_files_in_repo(files, hook_details)
评论列表
文章目录