def test_1080(self): """create with detailCode, description and traceInformation, then serialize()""" e = exceptions.ServiceFailure('123.456.789', description='test description', traceInformation='test traceInformation') self.sample.assert_equals(e.serialize(), 'create_with_trace_information')
def test_1070(self): """create with string detailCode and description, then serialize()""" e = exceptions.ServiceFailure('123.456.789', 'test description') se = e.serialize() assert se == u'<?xml version="1.0" encoding="utf-8"?>' \ u'<error detailCode="123.456.789" errorCode="500" name="ServiceFailure">' \ u'<description>test description</description></error>'
def test_1080(self): """create with detailCode, description and traceInformation, then serialize()""" e = exceptions.ServiceFailure('123.456.789', description='test description', traceInformation='test traceInformation') se = e.serialize() assert se == u'<?xml version="1.0" encoding="utf-8"?>' \ u'<error detailCode="123.456.789" errorCode="500" name="ServiceFailure">' \ u'<description>test description</description>' \ u'<traceInformation>test traceInformation</traceInformation></error>'
def test_1110(self): """create with detailCode, description and traceInformation, then serialize_to_display()""" e = exceptions.ServiceFailure( "123.456.789", description="test description", traceInformation="test traceInformation", ) self.sample.assert_equals(e.serialize_to_display(), "create_with_trace_information")
def test_280(self): """serialize_to_headers()""" e = exceptions.ServiceFailure('123.456.789', 'test description', 'test traceInformation') headers = e.serialize_to_headers() self.assertTrue(('DataONE-Exception-Name', u'ServiceFailure') in headers) self.assertTrue(('DataONE-Exception-ErrorCode', u'500') in headers) self.assertTrue(('DataONE-Exception-DetailCode', u'123.456.789') in headers) self.assertTrue(('DataONE-Exception-Description', u'test description') in headers) self.assertTrue(('DataONE-Exception-TraceInformation', u'test traceInformation') in headers)
def test_1090(self): """serialize_to_headers()""" e = exceptions.ServiceFailure('123.456.789', 'test description', 'test traceInformation') header_dict = e.serialize_to_headers() expected_dict = { 'DataONE-Exception-TraceInformation': 'test traceInformation', 'DataONE-Exception-DetailCode': '123.456.789', 'DataONE-Exception-Name': 'ServiceFailure', 'DataONE-Exception-Description': 'test description', 'DataONE-Exception-NodeID': '', 'DataONE-Exception-Identifier': '', 'DataONE-Exception-ErrorCode': '500' } assert header_dict == expected_dict
def test_1120(self): """serialize_to_headers()""" e = exceptions.ServiceFailure("123.456.789", "test description", "test traceInformation") header_dict = e.serialize_to_headers() expected_dict = { "DataONE-Exception-TraceInformation": "test traceInformation", "DataONE-Exception-DetailCode": "123.456.789", "DataONE-Exception-Name": "ServiceFailure", "DataONE-Exception-Description": "test description", "DataONE-Exception-NodeID": "", "DataONE-Exception-Identifier": "", "DataONE-Exception-ErrorCode": "500", } assert header_dict == expected_dict
def test_1070(self): """create with string detailCode and description, then serialize()""" e = exceptions.ServiceFailure('123.456.789', 'test description') self.sample.assert_equals(e.serialize(), 'create_with_description')
def test_1060(self): """create with only detailCode then serialize()""" e = exceptions.ServiceFailure(123) self.sample.assert_equals(e.serialize(), 'create_with_detail_code')
def test_1060(self): """create with only detailCode then serialize()""" e = exceptions.ServiceFailure(123) assert e.serialize() == u'<?xml version="1.0" encoding="utf-8"?>' \ u'<error detailCode="123" errorCode="500" name="ServiceFailure"/>'
def test_1100(self): """create with string detailCode and description, then serialize_to_display()""" e = exceptions.ServiceFailure("123.456.789", "test description") self.sample.assert_equals(e.serialize_to_display(), "create_with_description")