@@ -157,7 +157,8 @@ def test_write_check_quota():
157
157
_collection = Mock (),
158
158
_version_nums = Mock (find_one_and_update = Mock (return_value = {'version' :1 })),
159
159
_versions = Mock (insert_one = lambda x :None ),
160
- _arctic_lib = create_autospec (ArcticLibraryBinding ),
160
+ _arctic_lib = create_autospec (ArcticLibraryBinding ,
161
+ arctic = create_autospec (Arctic , mongo_host = 'some_host' )),
161
162
_publish_changes = False )
162
163
vs ._collection .database .connection .nodes = []
163
164
vs ._write_handler .return_value = write_handler
@@ -327,7 +328,8 @@ def _create_mock_versionstore():
327
328
vs ._add_new_version_using_reference .side_effect = lambda * args : VersionStore ._add_new_version_using_reference (vs , * args )
328
329
vs ._last_version_seqnum = lambda version : VersionStore ._last_version_seqnum (vs , version )
329
330
vs .write .return_value = VersionedItem (symbol = TEST_SYMBOL , library = vs ._arctic_lib .get_name (),
330
- version = TPL_VERSION ['version' ] + 1 , metadata = META_TO_WRITE , data = None )
331
+ version = TPL_VERSION ['version' ] + 1 , metadata = META_TO_WRITE , data = None ,
332
+ host = vs ._arctic_lib .arctic .mongo_host )
331
333
return vs
332
334
333
335
@@ -351,6 +353,7 @@ def test_write_metadata_with_previous_data():
351
353
352
354
expected_ret_val = VersionedItem (symbol = TEST_SYMBOL ,
353
355
library = vs ._arctic_lib .get_name (),
356
+ host = vs ._arctic_lib .arctic .mongo_host ,
354
357
version = TPL_VERSION ['version' ] + 1 ,
355
358
metadata = META_TO_WRITE ,
356
359
data = None )
@@ -376,6 +379,7 @@ def test_write_empty_metadata():
376
379
377
380
expected_ret_val = VersionedItem (symbol = TEST_SYMBOL ,
378
381
library = vs ._arctic_lib .get_name (),
382
+ host = vs ._arctic_lib .arctic .mongo_host ,
379
383
version = TPL_VERSION ['version' ] + 1 ,
380
384
metadata = None ,
381
385
data = None )
@@ -416,9 +420,11 @@ def test_restore_version():
416
420
417
421
LASTEST_VERSION = dict (TPL_VERSION , version = TPL_VERSION ['version' ]+ 1 , metadata = {'something' : 'different' })
418
422
last_item = VersionedItem (symbol = TEST_SYMBOL , library = vs ._arctic_lib .get_name (),
423
+ host = vs ._arctic_lib .arctic .mongo_host ,
419
424
version = LASTEST_VERSION , metadata = LASTEST_VERSION ['metadata' ], data = "hello world" )
420
425
new_version = dict (LASTEST_VERSION , version = LASTEST_VERSION ['version' ] + 1 )
421
426
new_item = VersionedItem (symbol = TEST_SYMBOL , library = vs ._arctic_lib .get_name (),
427
+ host = vs ._arctic_lib .arctic .mongo_host ,
422
428
version = new_version , metadata = new_version ['metadata' ], data = last_item .data )
423
429
424
430
vs .write .return_value = new_item
@@ -479,7 +485,8 @@ def test_write_error_clean_retry():
479
485
_collection = Mock (),
480
486
_version_nums = Mock (find_one_and_update = Mock (return_value = {'version' : 1 })),
481
487
_versions = Mock (insert_one = Mock (__name__ = "insert_one" ), find_one = Mock (__name__ = "find_one" )),
482
- _arctic_lib = create_autospec (ArcticLibraryBinding ),
488
+ _arctic_lib = create_autospec (ArcticLibraryBinding ,
489
+ arctic = create_autospec (Arctic , mongo_host = 'some_host' )),
483
490
_publish_changes = False )
484
491
vs ._insert_version = lambda version : VersionStore ._insert_version (vs , version )
485
492
vs ._collection .database .connection .nodes = []
@@ -498,7 +505,8 @@ def test_write_insert_version_duplicatekey():
498
505
_collection = Mock (),
499
506
_version_nums = Mock (find_one_and_update = Mock (return_value = {'version' : 1 })),
500
507
_versions = Mock (insert_one = Mock (__name__ = "insert_one" ), find_one = Mock (__name__ = "find_one" )),
501
- _arctic_lib = create_autospec (ArcticLibraryBinding ),
508
+ _arctic_lib = create_autospec (ArcticLibraryBinding ,
509
+ arctic = create_autospec (Arctic , mongo_host = 'some_host' )),
502
510
_publish_changes = False )
503
511
vs ._insert_version = lambda version : VersionStore ._insert_version (vs , version )
504
512
vs ._versions .insert_one .side_effect = [DuplicateKeyError ("dup key error" ), None ]
@@ -518,7 +526,8 @@ def test_write_insert_version_operror():
518
526
_collection = Mock (),
519
527
_version_nums = Mock (find_one_and_update = Mock (return_value = {'version' : 1 })),
520
528
_versions = Mock (insert_one = Mock (__name__ = "insert_one" ), find_one = Mock (__name__ = "find_one" )),
521
- _arctic_lib = create_autospec (ArcticLibraryBinding ),
529
+ _arctic_lib = create_autospec (ArcticLibraryBinding ,
530
+ arctic = create_autospec (Arctic , mongo_host = 'some_host' )),
522
531
_publish_changes = False )
523
532
vs ._insert_version = lambda version : VersionStore ._insert_version (vs , version )
524
533
vs ._versions .insert_one .side_effect = [OperationFailure ("mongo op error" ), None ]
@@ -541,7 +550,8 @@ def test_append_error_clean_retry():
541
550
_collection = Mock (),
542
551
_version_nums = Mock (find_one_and_update = Mock (return_value = {'version' : previous_version ['version' ]+ 1 })),
543
552
_versions = Mock (insert_one = Mock (__name__ = "insert_one" ), find_one = Mock (__name__ = "find_one" , return_value = previous_version )),
544
- _arctic_lib = create_autospec (ArcticLibraryBinding ),
553
+ _arctic_lib = create_autospec (ArcticLibraryBinding ,
554
+ arctic = create_autospec (Arctic , mongo_host = 'some_host' )),
545
555
_publish_changes = False )
546
556
vs ._insert_version = lambda version : VersionStore ._insert_version (vs , version )
547
557
vs ._collection .database .connection .nodes = []
@@ -562,7 +572,8 @@ def test_append_insert_version_duplicatekey():
562
572
_collection = Mock (),
563
573
_version_nums = Mock (find_one_and_update = Mock (return_value = {'version' : previous_version ['version' ]+ 1 })),
564
574
_versions = Mock (insert_one = Mock (__name__ = "insert_one" ), find_one = Mock (__name__ = "find_one" , return_value = previous_version )),
565
- _arctic_lib = create_autospec (ArcticLibraryBinding ),
575
+ _arctic_lib = create_autospec (ArcticLibraryBinding ,
576
+ arctic = create_autospec (Arctic , mongo_host = 'some_host' )),
566
577
_publish_changes = False )
567
578
vs ._insert_version = lambda version : VersionStore ._insert_version (vs , version )
568
579
vs ._versions .insert_one .side_effect = [DuplicateKeyError ("dup key error" ), None ]
@@ -583,7 +594,8 @@ def test_append_insert_version_operror():
583
594
_collection = Mock (),
584
595
_version_nums = Mock (find_one_and_update = Mock (return_value = {'version' : previous_version ['version' ]+ 1 })),
585
596
_versions = Mock (insert_one = Mock (__name__ = "insert_one" ), find_one = Mock (__name__ = "find_one" , return_value = previous_version )),
586
- _arctic_lib = create_autospec (ArcticLibraryBinding ),
597
+ _arctic_lib = create_autospec (ArcticLibraryBinding ,
598
+ arctic = create_autospec (Arctic , mongo_host = 'some_host' )),
587
599
_publish_changes = False )
588
600
vs ._insert_version = lambda version : VersionStore ._insert_version (vs , version )
589
601
vs ._versions .insert_one .side_effect = [OperationFailure ("mongo op error" ), None ]
0 commit comments