Skip to content

Commit f7f3af9

Browse files
committed
Update functional test to reflect default proof mech
1 parent cb0a1e6 commit f7f3af9

3 files changed

Lines changed: 45 additions & 9 deletions

File tree

archivist/confirmer.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,28 +52,32 @@ def __on_giveup_confirmation(details: "Details"):
5252
def _wait_for_confirmation(
5353
self: "_AssetsRestricted",
5454
identity: str,
55-
) -> "Asset": ... # pragma: no cover
55+
) -> "Asset":
56+
... # pragma: no cover
5657

5758

5859
@overload
5960
def _wait_for_confirmation(
6061
self: "_AssetsPublic",
6162
identity: str,
62-
) -> "Asset": ... # pragma: no cover
63+
) -> "Asset":
64+
... # pragma: no cover
6365

6466

6567
@overload
6668
def _wait_for_confirmation(
6769
self: "_EventsRestricted",
6870
identity: str,
69-
) -> "Event": ... # pragma: no cover
71+
) -> "Event":
72+
... # pragma: no cover
7073

7174

7275
@overload
7376
def _wait_for_confirmation(
7477
self: "_EventsPublic",
7578
identity: str,
76-
) -> "Event": ... # pragma: no cover
79+
) -> "Event":
80+
... # pragma: no cover
7781

7882

7983
@backoff.on_predicate(

functests/execassets.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ def setUp(self):
129129
self.traffic_light = deepcopy(ATTRS)
130130
self.traffic_light["arc_display_type"] = "Traffic light with violation camera"
131131
self.traffic_light_merkle_log = deepcopy(ATTRS)
132-
self.traffic_light_merkle_log["arc_display_type"] = (
133-
"Traffic light with violation camera (merkle_log)"
134-
)
132+
self.traffic_light_merkle_log[
133+
"arc_display_type"
134+
] = "Traffic light with violation camera (merkle_log)"
135135

136136
def tearDown(self):
137137
self.arch.close()
@@ -143,10 +143,10 @@ def test_asset_create_simple_hash(self):
143143
"""
144144
Test asset creation uses simple hash proof mechanism
145145
"""
146-
# default is simple hash so it is unspecified
147146
asset = self.arch.assets.create(
148147
attrs=self.traffic_light,
149148
confirm=True,
149+
props={"proof_mechanism": ProofMechanism.SIMPLE_HASH.name},
150150
)
151151
LOGGER.debug("asset %s", json_dumps(asset, sort_keys=True, indent=4))
152152
self.assertEqual(

functests/execpublicassets.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,13 @@ def tearDown(self):
9898

9999
def test_public_asset_create_simple_hash(self):
100100
"""
101-
Test asset creation uses simple hash proof mechanism
101+
Test public asset creation with the simple hash proof mechanism
102102
"""
103103
asset = self.arch.assets.create(
104104
attrs=self.traffic_light,
105105
props={
106106
"public": True,
107+
"proof_mechanism": ProofMechanism.SIMPLE_HASH.name,
107108
},
108109
confirm=True,
109110
)
@@ -126,6 +127,37 @@ def test_public_asset_create_simple_hash(self):
126127
events = public.events.list(asset_id=asset_publicurl)
127128
LOGGER.debug("events %s", json_dumps(list(events), sort_keys=True, indent=4))
128129

130+
def test_public_asset_create_merkle_log(self):
131+
"""
132+
Test public asset creation with the merkle log proof mechanism
133+
"""
134+
asset = self.arch.assets.create(
135+
attrs=self.traffic_light,
136+
props={
137+
"public": True,
138+
"proof_mechanism": ProofMechanism.MERKLE_LOG.name,
139+
},
140+
confirm=True,
141+
)
142+
LOGGER.debug("asset %s", json_dumps(asset, sort_keys=True, indent=4))
143+
self.assertEqual(
144+
asset["proof_mechanism"],
145+
ProofMechanism.MERKLE_LOG.name,
146+
msg="Incorrect asset proof mechanism",
147+
)
148+
self.assertEqual(
149+
asset["public"],
150+
True,
151+
msg="Asset is not public",
152+
)
153+
asset_publicurl = self.arch.assets.publicurl(asset["identity"])
154+
LOGGER.debug("asset_publicurl %s", asset_publicurl)
155+
public = self.arch.Public
156+
count = public.events.count(asset_id=asset_publicurl)
157+
LOGGER.debug("count %s", count)
158+
events = public.events.list(asset_id=asset_publicurl)
159+
LOGGER.debug("events %s", json_dumps(list(events), sort_keys=True, indent=4))
160+
129161
def test_public_asset_create_event(self):
130162
"""
131163
Test list

0 commit comments

Comments
 (0)