self = <swh.storage.tests.test_cassandra.TestCassandraStorage object at 0x7f1bcae11f98>
swh_storage = <swh.storage.validate.ValidatingProxyStorage object at 0x7f1bc9aaac18>
def test_object_find_by_sha1_git(self, swh_storage):
sha1_gits = [b"00000000000000000000"]
expected = {
b"00000000000000000000": [],
}
swh_storage.content_add([data.cont])
sha1_gits.append(data.cont["sha1_git"])
expected[data.cont["sha1_git"]] = [
{"sha1_git": data.cont["sha1_git"], "type": "content",}
]
swh_storage.directory_add([data.dir])
sha1_gits.append(data.dir["id"])
expected[data.dir["id"]] = [{"sha1_git": data.dir["id"], "type": "directory",}]
> swh_storage.revision_add([data.revision])
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_storage.py:3206:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/storage/validate.py:104: in revision_add
[dict_converter(Revision, r) for r in revisions]
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/storage.py:433: in revision_add
revobject = revision_to_db(revision)
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/converters.py:38: in revision_to_db
db_revision["metadata"] = json.dumps(db_revision["metadata"])
/usr/lib/python3.7/json/__init__.py:231: in dumps
return _default_encoder.encode(obj)
/usr/lib/python3.7/json/encoder.py:199: in encode
chunks = self.iterencode(o, _one_shot=True)
/usr/lib/python3.7/json/encoder.py:257: in iterencode
return _iterencode(o, 0)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <json.encoder.JSONEncoder object at 0x7f1d7fd98cc0>
o = <swh.model.collections.ImmutableDict object at 0x7f1cd43ad668>
def default(self, o):
"""Implement this method in a subclass such that it returns
a serializable object for ``o``, or calls the base implementation
(to raise a ``TypeError``).
For example, to support arbitrary iterators, you could
implement default like this::
def default(self, o):
try:
iterable = iter(o)
except TypeError:
pass
else:
return list(iterable)
# Let the base class default method raise the TypeError
return JSONEncoder.default(self, o)
"""
> raise TypeError(f'Object of type {o.__class__.__name__} '
f'is not JSON serializable')
E TypeError: Object of type ImmutableDict is not JSON serializable
/usr/lib/python3.7/json/encoder.py:179: TypeError
TEST RESULT
TEST RESULT
- Run At
- Jul 9 2020, 10:49 AM