self = <swh.storage.tests.test_cassandra.TestCassandraStorage object at 0x7f87384b3668>
swh_storage = <swh.storage.validate.ValidatingProxyStorage object at 0x7f87383c7860>
def test_revision_add_twice(self, swh_storage):
actual_result = swh_storage.revision_add([data.revision])
assert actual_result == {"revision:add": 1}
assert list(swh_storage.journal_writer.journal.objects) == [
("revision", Revision.from_dict(data.revision))
]
> actual_result = swh_storage.revision_add([data.revision, data.revision2])
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_storage.py:1002:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.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)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
revision = Revision(message=b'hello again', author=Person(fullname=b'Roberto Dicosmo <roberto@example.com>', name=b'Roberto Dicos...one, parents=(b'01234567890123456789',), id=b'\xdfzoj\x99g\x1f\xb7\xf746A\xaf\xf9\x83\xa3\x14\xefaa', extra_headers=())
def revision_to_db(revision: Revision) -> Dict[str, Any]:
# we use a deepcopy of the dict because we do not want to recurse the
# Model->dict conversion (to keep Timestamp & al. entities), BUT we do not
# want to modify original metadata (embedded in the Model entity), so we
# non-recursively convert it as a dict but make a deep copy.
db_revision = deepcopy(attr.asdict(revision, recurse=False))
metadata = revision.metadata
extra_headers = revision.extra_headers
if not extra_headers and metadata and "extra_headers" in metadata:
extra_headers = db_revision["metadata"].pop("extra_headers")
db_revision["metadata"] = json.dumps(
> dict(db_revision["metadata"] if db_revision["metadata"] is not None else None)
)
E TypeError: 'NoneType' object is not iterable
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/converters.py:39: TypeError
TEST RESULT
TEST RESULT
- Run At
- Jul 9 2020, 11:41 AM