15 lines
758 B
Python
15 lines
758 B
Python
|
|
import hashlib
|
||
|
|
from importlib.resources import files
|
||
|
|
import json
|
||
|
|
import unittest
|
||
|
|
from user_engine.custody_canon import policy
|
||
|
|
|
||
|
|
|
||
|
|
class CustodyPolicyPackageTests(unittest.TestCase):
|
||
|
|
def test_pinned_policy_and_schema_integrity(self):
|
||
|
|
package = files("user_engine.custody_canon")
|
||
|
|
receipt = json.loads(package.joinpath("provenance.json").read_text())
|
||
|
|
self.assertEqual(hashlib.sha256(package.joinpath("policy.py").read_bytes()).hexdigest(), receipt["packaged_policy_sha256"])
|
||
|
|
self.assertEqual(hashlib.sha256(package.joinpath("custody-record_v0.1.schema.json").read_bytes()).hexdigest(), receipt["schema_sha256"])
|
||
|
|
self.assertEqual(policy.load_schema()["$id"], "https://policy.coulomb.social/schemas/custody-record/v0.1")
|