self = <swh.storage.tests.test_cassandra.TestCassandraStorage object at 0x7f87780db4a8>
swh_storage = <swh.storage.validate.ValidatingProxyStorage object at 0x7f87780db9b0>
def test_revision_add_name_clash(self, swh_storage):
revision1 = data.revision
revision2 = data.revision2
revision1["author"] = {
"fullname": b"John Doe <john.doe@example.com>",
"name": b"John Doe",
"email": b"john.doe@example.com",
}
revision2["author"] = {
"fullname": b"John Doe <john.doe@example.com>",
"name": b"John Doe ",
"email": b"john.doe@example.com ",
}
> actual_result = swh_storage.revision_add([revision1, revision2])
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_storage.py:1024:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.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'John Doe <john.doe@example.com>', name=b'John Doe ', email=b...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