test_github_controller.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:triggear 作者: futuresimple 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号