3333 "some_custom_attribute" : "value" ,
3434}
3535
36+ SIMPLE_HASH = {
37+ "proof_mechanism" : ProofMechanism .SIMPLE_HASH .name ,
38+ }
39+ MERKLE_LOG = {
40+ "proof_mechanism" : ProofMechanism .MERKLE_LOG .name ,
41+ }
42+
3643ASSET_NAME = "Telephone with 2 attachments - one bad or not scanned 2022-03-01"
3744REQUEST_EXISTS_ATTACHMENTS_SIMPLE_HASH = {
3845 "selector" : [
@@ -121,6 +128,10 @@ def setUp(self):
121128 self .attrs = deepcopy (ATTRS )
122129 self .traffic_light = deepcopy (ATTRS )
123130 self .traffic_light ["arc_display_type" ] = "Traffic light with violation camera"
131+ 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+ )
124135
125136 def tearDown (self ):
126137 self .arch .close ()
@@ -132,6 +143,7 @@ def test_asset_create_simple_hash(self):
132143 """
133144 Test asset creation uses simple hash proof mechanism
134145 """
146+ # default is simple hash so it is unspecified
135147 asset = self .arch .assets .create (
136148 attrs = self .traffic_light ,
137149 confirm = True ,
@@ -145,7 +157,25 @@ def test_asset_create_simple_hash(self):
145157 tenancy = self .arch .tenancies .publicinfo (asset ["tenant_identity" ])
146158 LOGGER .debug ("tenancy %s" , json_dumps (tenancy , sort_keys = True , indent = 4 ))
147159
148- def test_asset_create_with_fixtures (self ):
160+ def test_asset_create_merkle_log (self ):
161+ """
162+ Test asset creation uses merkle_log proof mechanism
163+ """
164+ asset = self .arch .assets .create (
165+ props = MERKLE_LOG ,
166+ attrs = self .traffic_light_merkle_log ,
167+ confirm = True ,
168+ )
169+ LOGGER .debug ("asset %s" , json_dumps (asset , sort_keys = True , indent = 4 ))
170+ self .assertEqual (
171+ asset ["proof_mechanism" ],
172+ ProofMechanism .MERKLE_LOG .name ,
173+ msg = "Incorrect asset proof mechanism" ,
174+ )
175+ tenancy = self .arch .tenancies .publicinfo (asset ["tenant_identity" ])
176+ LOGGER .debug ("tenancy %s" , json_dumps (tenancy , sort_keys = True , indent = 4 ))
177+
178+ def test_asset_create_with_fixtures_simple_hash (self ):
149179 """
150180 Test creation with fixtures
151181 """
@@ -196,6 +226,59 @@ def test_asset_create_with_fixtures(self):
196226 msg = "Incorrect number of fancy_traffic_lights" ,
197227 )
198228
229+ def test_asset_create_with_fixtures_merkle_log (self ):
230+ """
231+ Test creation with fixtures
232+ """
233+ # creates simple_hash endpoint
234+ simple_hash = copy (self .arch )
235+ simple_hash .fixtures = {
236+ "assets" : {
237+ "proof_mechanism" : ProofMechanism .MERKLE_LOG .name ,
238+ },
239+ }
240+
241+ # create traffic lights endpoint from simple_hash
242+ traffic_lights = copy (simple_hash )
243+ traffic_lights .fixtures = {
244+ "assets" : {
245+ "attributes" : {
246+ "arc_display_type" : "Traffic light with violation camera (merkle_log)" ,
247+ "arc_namespace" : f"functests { uuid4 ()} " ,
248+ },
249+ },
250+ }
251+ traffic_lights .assets .create (
252+ props = MERKLE_LOG ,
253+ attrs = self .attrs ,
254+ confirm = True ,
255+ )
256+ self .assertEqual (
257+ traffic_lights .assets .count (),
258+ 1 ,
259+ msg = "Incorrect number of traffic_lights" ,
260+ )
261+
262+ # create fancy traffic lights endpoint from traffic lights
263+ fancy_traffic_lights = copy (traffic_lights )
264+ fancy_traffic_lights .fixtures = {
265+ "assets" : {
266+ "attributes" : {
267+ "arc_namespace1" : f"functests { uuid4 ()} " ,
268+ },
269+ },
270+ }
271+ fancy_traffic_lights .assets .create (
272+ props = MERKLE_LOG ,
273+ attrs = self .attrs ,
274+ confirm = True ,
275+ )
276+ self .assertEqual (
277+ fancy_traffic_lights .assets .count (),
278+ 1 ,
279+ msg = "Incorrect number of fancy_traffic_lights" ,
280+ )
281+
199282 def test_asset_create_event_merkle_log (self ):
200283 """
201284 Test list
0 commit comments