def test_nfs_exports_d_empty():
    nfs_exports = NFSExportsD(context_wrap(""))
    _do_empty(nfs_exports)
EXPORTS_D_EXTRAS = """
/mnt/work       *(rw,sync)
/mnt/backup     10.0.0.0/24(rw,sync,no_root_squash)
# This is a duplicate share but a new host, so it should be stored
/home/insights/shared/rw ins4.example.com(rw,sync,no_root_squash)
# We expect the following to be stored in the ignored_exports property
# as it has a duplicate host declaration for this path.
/home/insights/shared/rw ins1.example.com(rw,sync,no_root_squash)
/home/insights/shared/rw ins2.example.com(rw,sync,no_root_squash)
"""

# Set up combined test environment for docs and for more thorough functional
# testing.
nfs_exportsf = NFSExports(context_wrap(EXPORTS, path="/etc/exports"))
nfs_exportsd = [
    NFSExportsD(
        context_wrap(EXPORTS_D_EXTRAS, path="/etc/exports.d/mnt.exports"))
]
combined = nfs_exports.AllNFSExports(nfs_exportsf, nfs_exportsd)


def test_nfs_exports_docs():
    failed, total = testmod(nfs_exports, globs={'all_nfs': combined})
    assert failed == 0


def test_nfs_export_combiner():
    assert combined
    assert hasattr(combined, 'exports')
    assert isinstance(combined.exports, dict)
    assert combined.exports
    assert len(combined.exports) == 7
def test_nfs_exports_d():
    nfs_exports = NFSExportsD(context_wrap(EXPORTS))
    _do(nfs_exports)