77from unittest import TestCase , mock
88
99from archivist .archivist import Archivist
10- from archivist .assets import DEFAULT_PAGE_SIZE
10+ from archivist .assets import BEHAVIOURS , DEFAULT_PAGE_SIZE
1111from archivist .constants import (
1212 ASSETS_LABEL ,
1313 ASSETS_SUBPATH ,
2525# pylint: disable=unused-variable
2626
2727
28- BEHAVIOURS = [
29- "RecordEvidence" ,
30- "Attachments" ,
31- ]
3228PRIMARY_IMAGE = {
3329 "arc_display_name" : "arc_primary_image" ,
3430 "arc_attachment_identity" : "blobs/87b1a84c-1c6f-442b-923e-a97516f4d275" ,
7672IDENTITY = f"{ ASSETS_LABEL } /xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
7773SUBPATH = f"{ ASSETS_SUBPATH } /{ ASSETS_LABEL } "
7874
79- # TBD: add properties as well
75+ PROPS = {
76+ "storage_integrity" : StorageIntegrity .TENANT_STORAGE .name ,
77+ }
8078REQUEST = {
81- "behaviours" : BEHAVIOURS ,
8279 "storage_integrity" : StorageIntegrity .TENANT_STORAGE .name ,
8380 "attributes" : ATTRS ,
81+ "behaviours" : BEHAVIOURS ,
8482}
8583REQUEST_DATA = json .dumps (REQUEST )
8684
@@ -136,7 +134,7 @@ def test_assets_create(self):
136134 with mock .patch .object (self .arch ._session , "post" ) as mock_post :
137135 mock_post .return_value = MockResponse (200 , ** RESPONSE )
138136
139- asset = self .arch .assets .create (BEHAVIOURS , ATTRS , confirm = False )
137+ asset = self .arch .assets .create (PROPS , ATTRS , confirm = False )
140138 self .assertEqual (
141139 tuple (mock_post .call_args ),
142140 (
@@ -178,7 +176,7 @@ def test_assets_create_with_confirmation(self):
178176 ) as mock_post , mock .patch .object (self .arch ._session , "get" ) as mock_get :
179177 mock_post .return_value = MockResponse (200 , ** RESPONSE )
180178 mock_get .return_value = MockResponse (200 , ** RESPONSE )
181- asset = self .arch .assets .create (BEHAVIOURS , ATTRS , confirm = True )
179+ asset = self .arch .assets .create (PROPS , ATTRS , confirm = True )
182180 self .assertEqual (
183181 asset ,
184182 RESPONSE ,
@@ -194,7 +192,7 @@ def test_assets_create_with_explicit_confirmation(self):
194192 ) as mock_post , mock .patch .object (self .arch ._session , "get" ) as mock_get :
195193 mock_post .return_value = MockResponse (200 , ** RESPONSE )
196194 mock_get .return_value = MockResponse (200 , ** RESPONSE )
197- asset = self .arch .assets .create (BEHAVIOURS , ATTRS , confirm = False )
195+ asset = self .arch .assets .create (PROPS , ATTRS , confirm = False )
198196 self .arch .assets .wait_for_confirmation (asset ["identity" ])
199197 self .assertEqual (
200198 asset ,
@@ -213,7 +211,7 @@ def test_assets_create_with_confirmation_no_confirmed_status(self):
213211 mock_get .return_value = MockResponse (200 , ** RESPONSE_NO_CONFIRMATION )
214212
215213 with self .assertRaises (ArchivistUnconfirmedError ):
216- asset = self .arch .assets .create (BEHAVIOURS , ATTRS , confirm = True )
214+ asset = self .arch .assets .create (PROPS , ATTRS , confirm = True )
217215
218216 def test_assets_create_with_confirmation_pending_status (self ):
219217 """
@@ -227,7 +225,7 @@ def test_assets_create_with_confirmation_pending_status(self):
227225 MockResponse (200 , ** RESPONSE_PENDING ),
228226 MockResponse (200 , ** RESPONSE ),
229227 ]
230- asset = self .arch .assets .create (BEHAVIOURS , ATTRS , confirm = True )
228+ asset = self .arch .assets .create (PROPS , ATTRS , confirm = True )
231229 self .assertEqual (
232230 asset ,
233231 RESPONSE ,
@@ -247,7 +245,7 @@ def test_assets_create_with_confirmation_failed_status(self):
247245 MockResponse (200 , ** RESPONSE_FAILED ),
248246 ]
249247 with self .assertRaises (ArchivistUnconfirmedError ):
250- asset = self .arch .assets .create (BEHAVIOURS , ATTRS , confirm = True )
248+ asset = self .arch .assets .create (PROPS , ATTRS , confirm = True )
251249
252250 def test_assets_create_with_confirmation_always_pending_status (self ):
253251 """
@@ -267,7 +265,7 @@ def test_assets_create_with_confirmation_always_pending_status(self):
267265 MockResponse (200 , ** RESPONSE_PENDING ),
268266 ]
269267 with self .assertRaises (ArchivistUnconfirmedError ):
270- asset = self .arch .assets .create (BEHAVIOURS , ATTRS , confirm = True )
268+ asset = self .arch .assets .create (PROPS , ATTRS , confirm = True )
271269
272270 def test_assets_read_with_out_primary_image (self ):
273271 """
0 commit comments