Browse Source

make sure json encoding fails on unhandled classes..

main
John-Mark Gurney 2 years ago
parent
commit
4b2b5a1b0a
2 changed files with 8 additions and 0 deletions
  1. +7
    -0
      ui/medashare/cli.py
  2. +1
    -0
      ui/medashare/tests.py

+ 7
- 0
ui/medashare/cli.py View File

@@ -278,6 +278,13 @@ class _JSONEncoder(json.JSONEncoder):

_jsonencoder = _JSONEncoder()

class _TestJSONEncoder(unittest.TestCase):
def test_defaultfailure(self):
class Foo:
pass

self.assertRaises(TypeError, _jsonencoder.encode, Foo())

class Persona(object):
'''The object that represents a persona, or identity. It will
create the proper identity object, serialize for saving keys,


+ 1
- 0
ui/medashare/tests.py View File

@@ -1,3 +1,4 @@
from .cli import _TestCononicalCoder, _TestCases as cli_test_cases
from .cli import _TestJSONEncoder
from .mtree import Test
from .server import _TestCases, _TestPostConfig

Loading…
Cancel
Save