Fixed an issue with tests mocking urlopen() responses, and tweaked error messages on bad results in sync/rfceditor.py
- Legacy-Id: 17356
This commit is contained in:
parent
ebdad3a5a5
commit
07747b26c3
|
@ -621,7 +621,7 @@ class BallotWriteupsTests(TestCase):
|
|||
class ApproveBallotTests(TestCase):
|
||||
@mock.patch('ietf.sync.rfceditor.urlopen', autospec=True)
|
||||
def test_approve_ballot(self, mock_urlopen):
|
||||
mock_urlopen.return_value.read = lambda :'OK'
|
||||
mock_urlopen.return_value.read = lambda : b'OK'
|
||||
mock_urlopen.return_value.getcode = lambda :200
|
||||
#
|
||||
ad = Person.objects.get(name="Areað Irector")
|
||||
|
|
|
@ -1201,7 +1201,7 @@ class SubmitToIesgTests(TestCase):
|
|||
class RequestPublicationTests(TestCase):
|
||||
@mock.patch('ietf.sync.rfceditor.urlopen', autospec=True)
|
||||
def test_request_publication(self, mock_urlopen):
|
||||
mock_urlopen.return_value.read = lambda :'OK'
|
||||
mock_urlopen.return_value.read = lambda : b'OK'
|
||||
mock_urlopen.return_value.getcode = lambda :200
|
||||
#
|
||||
draft = IndividualDraftFactory(stream_id='iab',group__acronym='iab',intended_std_level_id='inf',states=[('draft-stream-iab','approved')])
|
||||
|
|
|
@ -548,15 +548,15 @@ def post_approved_draft(url, name):
|
|||
log("RFC-Editor notification result for draft '%s': %s:'%s'" % (name, status_code, text))
|
||||
|
||||
if status_code != 200:
|
||||
raise Exception("Status code is not 200 OK (it's %s)." % status_code)
|
||||
raise RuntimeError("Status code is not 200 OK (it's %s)." % status_code)
|
||||
|
||||
if text != "OK":
|
||||
raise Exception("Response is not \"OK\".")
|
||||
raise RuntimeError("Response is not \"OK\".")
|
||||
|
||||
except Exception as e:
|
||||
# catch everything so we don't leak exceptions, convert them
|
||||
# into string instead
|
||||
msg = "Exception on RFC-Editor notification for draft '%s': '%s'" % (name, e)
|
||||
msg = "Exception on RFC-Editor notification for draft '%s': %s: %s" % (name, type(e), str(e))
|
||||
log(msg)
|
||||
if settings.SERVER_MODE == 'test':
|
||||
debug.say(msg)
|
||||
|
|
Loading…
Reference in a new issue