Error: typ/title no omitempty

This commit is contained in:
Jakub Warmuz 2015-05-19 19:50:00 +00:00
parent 41115bfc77
commit 0018bc0500
No known key found for this signature in database
GPG key ID: 2A7BAD3A489B52EA
3 changed files with 5 additions and 4 deletions

View file

@ -18,8 +18,8 @@ class Error(jose.JSONObjectWithFields, Exception):
'badCSR': 'The CSR is unacceptable (e.g., due to a short key)',
}
typ = jose.Field('type', omitempty=True)
title = jose.Field('title', omitempty=True)
typ = jose.Field('type')
title = jose.Field('title')
detail = jose.Field('detail')
@typ.encoder

View file

@ -21,7 +21,7 @@ class ErrorTest(unittest.TestCase):
def setUp(self):
from acme.messages2 import Error
self.error = Error(detail='foo', typ='malformed')
self.error = Error(detail='foo', typ='malformed', title='title')
def test_typ_prefix(self):
self.assertEqual('malformed', self.error.typ)

View file

@ -114,7 +114,8 @@ class NetworkTest(unittest.TestCase):
def test_check_response_not_ok_jobj_error(self):
self.response.ok = False
self.response.json.return_value = messages2.Error(detail='foo')
self.response.json.return_value = messages2.Error(
detail='foo', typ='serverInternal', title='some title').to_json()
# pylint: disable=protected-access
self.assertRaises(
messages2.Error, self.net._check_response, self.response)