def test__when_get_repo_labels_is_called__only_label_names_are_returned(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)
# given
when(github_client).get_repo('repo')\
.thenReturn(github_repository)
when(github_repository).get_labels()\
.thenReturn([label, other_label])
# when
result: List[str] = github_controller.get_repo_labels('repo')
# then
assert result == ['label', 'other_label']
评论列表
文章目录