def test_01_init_with_xml(self):
     error_d = Error_Document(ED)
     assert error_d.error_href == "http://example.org/errors/BadManifest"
     assert error_d.title == "ERROR"
     assert error_d.summary == """The manifest could be parsed, but was not valid - 
 no technical metadata was provided."""
     print(error_d.metadata)
     assert error_d.verbose_description[0].strip() == """Exception at [ ... ]""", error_d.verbose_description
Exemplo n.º 2
0
 def test_04_invalid_code_with_known_error_iri(self):
     error_d = Error_Document(ED2, code=499)
     assert error_d.error_href == "http://purl.org/net/sword/error/TargetOwnerUnknown"
     assert error_d.error_info['name'] == "UNKNOWNERROR"
     assert error_d.error_info['codes'] == [499]
Exemplo n.º 3
0
 def test_04_validate_code_with_known_error_iri(self):
     error_d = Error_Document(ED2, code=403)
     assert error_d.error_href == "http://purl.org/net/sword/error/TargetOwnerUnknown"
     assert error_d.error_info['name'] == "TargetOwnerUnknown"
     assert error_d.error_info['codes'] == [403]
Exemplo n.º 4
0
 def test_03_init_with_known_error_iri(self):
     error_d = Error_Document(ED2)
     assert error_d.error_href == "http://purl.org/net/sword/error/TargetOwnerUnknown"
     assert error_d.error_info['name'] == "TargetOwnerUnknown"
Exemplo n.º 5
0
 def test_02_error_info(self):
     error_d = Error_Document(ED)
     # Error href is not a known SWORD2 error
     assert error_d.error_info[
         'IRI'] == "http://example.org/errors/BadManifest"
     assert error_d.error_info['name'] == "UNKNOWNERROR"
Exemplo n.º 6
0
 def test_00_blank_init(self):
     error_d = Error_Document(code=402, resp={'content-type': 'text/plain'})
     assert error_d.code == 402
     assert error_d.response_headers['content-type'] == 'text/plain'