Test that creating contract from legacy json keeps all values from contract_json.
Source code in tests/unit/apps/core/models/test_contract.py
| def test_contract_from_legacy(legacy_contract_json):
"""Test that creating contract from legacy json keeps all values from contract_json."""
legacy_contract_json["contract_json"]["created"] = normalize_datetime_str(
legacy_contract_json["contract_json"]["created"]
)
legacy_contract_json["contract_json"]["modified"] = normalize_datetime_str(
legacy_contract_json["contract_json"]["modified"]
)
contract, created = Contract.create_or_update_from_legacy(legacy_contract_json)
assert created
to_legacy = contract.to_legacy()
assert to_legacy["contract_json"] == legacy_contract_json["contract_json"]
assert to_legacy["id"] == legacy_contract_json["id"]
|