def test_createUserRepo(mockGithub):
    gh = GitHub(token='foo')
    gh.github = mockGithub
    user = gh._getUser()
    gh._createUserRepo('testRepo')

    user.create_repo.assert_called_with(name='testRepo', has_issues=True, auto_init=True, private=True)
def test_deploy_withRepo(fs):
    MockedFiles._mockCorrectFileSystem(fs)

    def mock_returnNone(*args, **kwargs):
        return None

    gh = GitHub(token='foo')
    gh._createOrgRepo = MagicMock(return_value=mock_returnNone)
    gh._createUserRepo = MagicMock(return_value=mock_returnNone)
    gh._deleteLabels = MagicMock(return_value=mock_returnNone)
    gh._createProject = MagicMock(return_value=mock_returnNone)
    gh._createColumns = MagicMock(return_value=mock_returnNone)
    gh._createMilestone = MagicMock(return_value=mock_returnNone)
    gh._createIssue = MagicMock(return_value=mock_returnNone)
    gh._createCard = MagicMock(return_value=mock_returnNone)
    gh._buildDescription = MagicMock(return_value=mock_returnNone)

    backlog = Backlog()
    config = backlog._getConfig('workitems/correct')
    workItems = backlog._buildWorkItems(MockedFiles._mockParsedFileList(), config)

    args = argparse.Namespace()
    args.org = None
    args.repo = 'testUser'
    args.project = 'testProject'
    args.backlog = 'correct'

    gh.deploy(args, workItems)
    gh._createUserRepo.assert_called_with('testProject')

    gh._deleteLabels.assert_called()
    assert gh._createProject.call_count == 4
    assert gh._createColumns.call_count == 4
    assert gh._createMilestone.call_count == 6
    assert gh._createIssue.call_count == 4
    assert gh._createCard.call_count == 4