Beispiel #1
0
def test_create_label(mock_Github):
    gh = GitHub(token='foo')
    gh.github = mock_Github
    repo = gh._get_user().create_repo()
    gh._create_label(repo, 'testLabel', '000000')

    repo.create_label.assert_called_with('testLabel', '000000')
Beispiel #2
0
def test_delete_label(mock_Github):
    gh = GitHub(token='foo')
    gh.github = mock_Github
    repo = gh._get_user().create_repo()
    label = gh._create_label(repo, 'test', '000000')
    gh._delete_label(label)

    label.delete.assert_called()
Beispiel #3
0
def test_create_labels(mock_Github):
    def mock_create_label(*args, **kwargs):
        return Noniterable_str(args[1])

    gh = GitHub(token='foo')
    gh.github = mock_Github
    repo = gh._get_user().create_repo()
    gh._create_label = MagicMock(side_effect=mock_create_label)

    names = ['test1', 'test2']
    colors = ['000000', '111111']
    labels = gh._create_labels(repo, names, colors)

    assert len(labels) == 2
    assert labels[0] == 'test1'
    assert labels[1] == "test2"