def test_list_files_single_file():
    client = mock.MagicMock()
    client.get_file_properties = mock.MagicMock()
    client.get_file_properties.return_value = 'fp'

    i = 0
    for file in ops.list_files(client, 'a', 'b/c', True):
        i += 1
        assert file == 'fp'
    assert i == 1
def test_list_files_directory(patched_cisf):
    _file = azure.storage.file.models.File(name='name')
    client = mock.MagicMock()
    client.list_directories_and_files.return_value = [_file]
    client.get_file_properties.return_value = _file

    i = 0
    for file in ops.list_files(client, 'dir', '', True):
        i += 1
        assert file.name == 'name'
    assert i == 1

    _dir = azure.storage.file.models.Directory(name='dirname')
    _file = azure.storage.file.models.File(name='dirname/name')
    client = mock.MagicMock()
    client.list_directories_and_files.side_effect = [[_dir, _file]]
    client.get_file_properties.side_effect = [_file]

    i = 0
    for file in ops.list_files(client, '', '', True):
        i += 1
        assert file.name == _file.name
        assert type(file) == azure.storage.file.models.File
    assert i == 1