def test_deploy(fs):
    MockedFiles._mockCorrectFileSystem(fs)

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

    az = AzDevOps(org='foo', token='bar')
    az._create_project = MagicMock(return_value=mock_return_None)
    az._get_project = MagicMock(return_value=SimpleNamespace(id=1))
    az._enable_epics = MagicMock(return_value=mock_return_None)
    az._create_work_item = MagicMock(return_value=mock_return_None)

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

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

    az.deploy(args, work_items)

    az._create_project.assert_called_with('testProject')
    az._enable_epics.assert_called()

    assert az._create_work_item.call_count == 20
def test_deploy(fs):
    MockedFiles._mock_correct_file_system(fs)

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

    az = AzDevOps(org='foo', token='bar')
    az._create_project = MagicMock(return_value=mock_return_None)
    az._get_project = MagicMock(return_value=SimpleNamespace(id=1))
    az._enable_epics = MagicMock(return_value=mock_return_None)
    az._create_work_item = MagicMock(return_value=mock_return_None)

    backlog = Backlog()
    config = backlog._get_config('workitems/correct', 'azure')
    config["_repository_path"] = './workitems/correct'
    work_items = backlog._build_work_items(
        MockedFiles._mock_parsed_file_list(), config)

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

    az.deploy(args, work_items, config, [])

    az._create_project.assert_called_with('testProject', 'Sample description')
    az._enable_epics.assert_called()

    assert az._create_work_item.call_count == 20