def test__get_pr_labels__should_return_only_label_names(self):
github_client: github.Github = mock(spec=github.Github, strict=True)
github_controller = GithubController(github_client, mock(), mock(), mock())
github_repository: github.Repository.Repository = mock(spec=github.Repository.Repository, strict=True)
label: github.Label.Label = mock({'name': 'label'}, spec=github.Label.Label, strict=True)
other_label: github.Label.Label = mock({'name': 'other_label'}, spec=github.Label.Label, strict=True)
github_issue: github.Issue.Issue = mock({'labels': [label, other_label]}, spec=github.Issue.Issue, strict=True)
when(github_client).get_repo('repo')\
.thenReturn(github_repository)
when(github_repository).get_issue(25)\
.thenReturn(github_issue)
labels: List[str] = github_controller.get_pr_labels('repo', 25)
assert ['label', 'other_label'] == labels
评论列表
文章目录