def test_gather_work_items(monkeypatch):
    def mock_gather_work_items_returns_file_list(*args, **kwargs):
        return MockedFiles._mock_file_list()

    monkeypatch.setattr(helpers.FileSystem, "get_files",
                        mock_gather_work_items_returns_file_list)

    backlog = helpers.Backlog()
    assert backlog._gather_work_items('.') == MockedFiles._mock_file_list()
def test_initialize_repo(fs):
    az = AzDevOps(org='foo', token='bar')
    project = SimpleNamespace(id=1)

    path = './workitems/correct'

    MockedFiles._mock_correct_file_system(fs)
    attachments = MockedFiles._mock_file_list()

    az._initialize_repo('foo', project, path, attachments)
    assert az.clients.get_git_client.return_value.create_push.called
    assert az.connection._client.send.called
def test_filter_work_items(fs):
    backlog = helpers.Backlog()
    result = backlog._filter_work_items(MockedFiles._mock_file_list())

    assert len(result) == 20
def test_filter_attachments(fs):
    backlog = helpers.Backlog()
    result = backlog._filter_attachments(MockedFiles._mock_file_list())

    assert len(result) == 3
 def mock_gather_work_items_return_file_list(*args, **kwargs):
     return list(
         filter(lambda x: x.endswith('metadata.json'),
                MockedFiles._mock_file_list()))
 def mock_gather_work_items_returns_file_list(*args, **kwargs):
     return MockedFiles._mock_file_list()
def test_parse_file_hierarchy():
    p = helpers.Parser()
    metadatas = list(filter(lambda x: x.endswith('metadata.json'), MockedFiles._mock_file_list()))
    parsed_files = p.parse_file_hierarchy(metadatas)

    assert parsed_files == MockedFiles._mock_parsed_file_list()