def test_1070(self): """get_element_text(): Non-existing element raises SimpleXMLWrapperException""" with d1_common.wrap.simple_xml.wrap(self.sysmeta_xml) as xml: with pytest.raises( d1_common.wrap.simple_xml.SimpleXMLWrapperException): xml.get_element_text('preferredMemberNode', 3)
def create_stream(version_tag, sciobj_stream, sysmeta_xml): """Call MNStorage.create()""" with d1_gmn.tests.gmn_mock.disable_sysmeta_sanity_checks(): with d1_common.wrap.simple_xml.wrap(sysmeta_xml) as xml: return _get_resp_dict(django.test.Client().post( d1_common.url.joinPathElements('/', version_tag, 'object'), { 'pid': xml.get_element_text('identifier'), 'object': ('content.bin', sciobj_stream), 'sysmeta': ('sysmeta.xml', StringIO.StringIO(sysmeta_xml)), }))
def test_1100(self): """set_element_dt()""" with d1_common.wrap.simple_xml.wrap(self.sysmeta_xml) as xml: xml.set_element_dt( 'dateUploaded', datetime.datetime( 1911, 2, 3, 4, 5, 6, 7890, tzinfo=d1_common.date_time.FixedOffset( '-2:30', offset_hours=-2, offset_minutes=30 ) ) ) assert xml.get_element_text( 'dateUploaded' ) == '1911-02-03T04:05:06.007890-01:30'
def test_1060(self): """get_element_text(): Returns XML element text, nested""" with d1_common.wrap.simple_xml.wrap(self.sysmeta_xml) as xml: assert xml.get_element_text('preferredMemberNode', 2) == 'node2'
def test_1050(self): """get_element_text(): Returns XML element text, root child""" with d1_common.wrap.simple_xml.wrap(self.sysmeta_xml) as xml: assert xml.get_element_text('rightsHolder') == 'test_rights_holder'