|
13 | 13 | import metsrw |
14 | 14 | from metsrw.plugins.premisrw import PREMISObject, PREMIS_3_0_NAMESPACES, lxmlns |
15 | 15 |
|
| 16 | +from lxml import etree |
| 17 | + |
16 | 18 |
|
17 | 19 | class TestNormativeStructMap(TestCase): |
18 | 20 | """Test normative logical structmap class.""" |
@@ -71,6 +73,7 @@ def test_write_normative_structmap(self): |
71 | 73 | # Create the parent directory of the empty directory and give it a |
72 | 74 | # simple PREMIS object also. |
73 | 75 | f3 = metsrw.FSEntry("level3.txt", file_uuid=str(uuid.uuid4())) |
| 76 | + f3.add_dmdsec(etree.Element("data"), "OTHER") |
74 | 77 | d2 = metsrw.FSEntry("dir2", type="Directory", children=[f3, d_empty]) |
75 | 78 | d2_id = str(uuid.uuid4()) |
76 | 79 | d2_premis_object = PREMISObject(identifier_value=d2_id) |
@@ -157,3 +160,14 @@ def test_write_normative_structmap(self): |
157 | 160 | "{}type".format(lxmlns("xsi", premis_version="3.0")) |
158 | 161 | ) |
159 | 162 | assert xsi_type == "premis:intellectualEntity" |
| 163 | + |
| 164 | + # Expect that the file in the normative logical structmap includes the |
| 165 | + # DMDID attribute. |
| 166 | + dmdid = normative_structmap_el.find(exists_in_both_path, metsrw.NAMESPACES).get( |
| 167 | + "DMDID" |
| 168 | + ) |
| 169 | + assert dmdid.startswith("dmdSec_") |
| 170 | + file_3_dmd_sec = doc.find( |
| 171 | + 'mets:dmdSec[@ID="{}"]'.format(dmdid), metsrw.NAMESPACES |
| 172 | + ) |
| 173 | + assert file_3_dmd_sec is not None |
0 commit comments