Fix invalid json unit test

Recent versions of oslo.serialization have made it possible to dump
exceptions to JSON, which broke a unit test in taskflow that
assumed exceptions were unserializable.  This change switches to an
explicitly unserializable class for that test.

Change-Id: If6d19bc9fcf1f1813cb087d42dc7ba6a61c71b3d
Closes-Bug: 1748241
This commit is contained in:
Ben Nemec 2018-02-08 16:58:42 +00:00
parent 406073e884
commit 44ce6eae91
1 changed files with 5 additions and 1 deletions

View File

@ -25,6 +25,10 @@ from taskflow.tests import utils
from taskflow.types import failure
class Unserializable(object):
pass
class TestProtocolValidation(test.TestCase):
def test_send_notify(self):
msg = pr.Notify()
@ -166,7 +170,7 @@ class TestProtocol(test.TestCase):
self.assertEqual(expected, request.to_dict())
def test_to_dict_with_invalid_json_failures(self):
exc = RuntimeError(Exception("I am not valid JSON"))
exc = RuntimeError(Unserializable())
a_failure = failure.Failure.from_exception(exc)
request = self.request(failures={self.task.name: a_failure})
expected = self.request_to_dict(