Changeset View
Changeset View
Standalone View
Standalone View
swh/model/tests/test_model.py
Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | def test_revision_model_id_computation(): | ||||
assert rev_model.id | assert rev_model.id | ||||
assert rev_model.id == hash_to_bytes(revision_identifier(rev_dict)) | assert rev_model.id == hash_to_bytes(revision_identifier(rev_dict)) | ||||
rev_model = Revision.from_dict(rev_dict) | rev_model = Revision.from_dict(rev_dict) | ||||
assert rev_model.id | assert rev_model.id | ||||
assert rev_model.id == hash_to_bytes(revision_identifier(rev_dict)) | assert rev_model.id == hash_to_bytes(revision_identifier(rev_dict)) | ||||
def test_revision_model_id_computation_with_no_date(): | |||||
"""We can have revision with date to None | |||||
""" | |||||
rev_dict = dict(revision_example) | |||||
rev_dict['date'] = None | |||||
rev_dict['committer_date'] = None | |||||
del rev_dict['id'] | |||||
rev_id = hash_to_bytes(revision_identifier(rev_dict)) | |||||
for rev_model in [Revision(**rev_dict), Revision.from_dict(rev_dict)]: | |||||
vlorentz: should compare its value | |||||
Not Done Inline ActionsYou can remove this assertion now, it's redundant because of the last one vlorentz: You can remove this assertion now, it's redundant because of the last one | |||||
Done Inline Actionsyes but i somehow kept it to be consistent with the other checks... ardumont: yes but i somehow kept it to be consistent with the other checks... | |||||
assert rev_model.date is None | |||||
assert rev_model.committer_date is None | |||||
assert rev_model.id == rev_id | |||||
def test_release_model_id_computation(): | def test_release_model_id_computation(): | ||||
rel_dict = dict(release_example) | rel_dict = dict(release_example) | ||||
del rel_dict['id'] | del rel_dict['id'] | ||||
rel_model = Release(**rel_dict) | rel_model = Release(**rel_dict) | ||||
assert rel_model.id | assert rel_model.id | ||||
assert rel_model.id == hash_to_bytes(release_identifier(rel_dict)) | assert rel_model.id == hash_to_bytes(release_identifier(rel_dict)) | ||||
Show All 16 Lines |
should compare its value