@@ -90,6 +90,7 @@ def test_help(capsys):
90
90
91
91
92
92
@mock .patch .object (utils .configparser , 'ConfigParser' )
93
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
93
94
def test_no_project (mock_config , capsys ):
94
95
fake_config = FakeConfig ()
95
96
del fake_config ._data ['options' ]['default' ]
@@ -106,6 +107,7 @@ def test_no_project(mock_config, capsys):
106
107
107
108
108
109
@mock .patch .object (utils .configparser , 'ConfigParser' )
110
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
109
111
def test_no_project_url (mock_config , capsys ):
110
112
fake_config = FakeConfig ()
111
113
del fake_config ._data [DEFAULT_PROJECT ]['url' ]
@@ -122,6 +124,7 @@ def test_no_project_url(mock_config, capsys):
122
124
123
125
124
126
@mock .patch .object (utils .configparser , 'ConfigParser' )
127
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
125
128
def test_missing_project (mock_config , capsys ):
126
129
mock_config .return_value = FakeConfig ()
127
130
@@ -160,6 +163,7 @@ def test_migrate_config(mock_migrate, mock_config):
160
163
161
164
162
165
@mock .patch .object (utils .configparser , 'ConfigParser' )
166
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
163
167
@mock .patch .object (api , 'XMLRPC' )
164
168
@mock .patch .object (patches , 'action_apply' )
165
169
def test_server_error (mock_action , mock_api , mock_config , capsys ):
@@ -176,6 +180,7 @@ def test_server_error(mock_action, mock_api, mock_config, capsys):
176
180
177
181
178
182
@mock .patch .object (utils .configparser , 'ConfigParser' )
183
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
179
184
@mock .patch .object (api , 'XMLRPC' )
180
185
@mock .patch .object (patches , 'action_apply' )
181
186
def test_apply (mock_action , mock_api , mock_config ):
@@ -203,6 +208,7 @@ def test_apply(mock_action, mock_api, mock_config):
203
208
204
209
205
210
@mock .patch .object (utils .configparser , 'ConfigParser' )
211
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
206
212
@mock .patch .object (api , 'XMLRPC' )
207
213
@mock .patch .object (patches , 'action_apply' )
208
214
def test_apply__failed (mock_action , mock_api , mock_config , capsys ):
@@ -225,6 +231,7 @@ def test_apply__failed(mock_action, mock_api, mock_config, capsys):
225
231
226
232
227
233
@mock .patch .object (utils .configparser , 'ConfigParser' )
234
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
228
235
@mock .patch .object (api , 'XMLRPC' )
229
236
@mock .patch .object (checks , 'action_create' )
230
237
def test_check_create (mock_action , mock_api , mock_config ):
@@ -263,6 +270,7 @@ def test_check_create(mock_action, mock_api, mock_config):
263
270
264
271
265
272
@mock .patch .object (utils .configparser , 'ConfigParser' )
273
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
266
274
@mock .patch .object (api , 'XMLRPC' )
267
275
@mock .patch .object (checks , 'action_create' )
268
276
def test_check_create__no_auth (
@@ -296,6 +304,7 @@ def test_check_create__no_auth(
296
304
297
305
298
306
@mock .patch .object (utils .configparser , 'ConfigParser' )
307
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
299
308
@mock .patch .object (api , 'XMLRPC' )
300
309
@mock .patch .object (checks , 'action_info' )
301
310
def test_check_info (mock_action , mock_api , mock_config ):
@@ -307,6 +316,7 @@ def test_check_info(mock_action, mock_api, mock_config):
307
316
308
317
309
318
@mock .patch .object (utils .configparser , 'ConfigParser' )
319
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
310
320
@mock .patch .object (api , 'XMLRPC' )
311
321
@mock .patch .object (checks , 'action_info' )
312
322
def test_check_info__no_patch_id (mock_action , mock_api , mock_config ):
@@ -318,6 +328,7 @@ def test_check_info__no_patch_id(mock_action, mock_api, mock_config):
318
328
319
329
320
330
@mock .patch .object (utils .configparser , 'ConfigParser' )
331
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
321
332
@mock .patch .object (api , 'XMLRPC' )
322
333
@mock .patch .object (checks , 'action_list' )
323
334
def test_check_list (mock_action , mock_api , mock_config ):
@@ -329,6 +340,7 @@ def test_check_list(mock_action, mock_api, mock_config):
329
340
330
341
331
342
@mock .patch .object (utils .configparser , 'ConfigParser' )
343
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
332
344
@mock .patch .object (api , 'XMLRPC' )
333
345
@mock .patch .object (patches , 'action_get' )
334
346
def test_get__numeric_id (mock_action , mock_api , mock_config ):
@@ -341,6 +353,7 @@ def test_get__numeric_id(mock_action, mock_api, mock_config):
341
353
342
354
343
355
@mock .patch .object (utils .configparser , 'ConfigParser' )
356
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
344
357
@mock .patch .object (api , 'XMLRPC' )
345
358
@mock .patch .object (patches , 'action_get' )
346
359
def test_get__multiple_ids (mock_action , mock_api , mock_config ):
@@ -359,6 +372,7 @@ def test_get__multiple_ids(mock_action, mock_api, mock_config):
359
372
360
373
361
374
@mock .patch .object (utils .configparser , 'ConfigParser' )
375
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
362
376
@mock .patch .object (api , 'XMLRPC' )
363
377
@mock .patch .object (patches , 'patch_id_from_hash' )
364
378
@mock .patch .object (patches , 'action_get' )
@@ -376,6 +390,7 @@ def test_get__hash_ids(mock_action, mock_hash, mock_api, mock_config):
376
390
377
391
378
392
@mock .patch .object (utils .configparser , 'ConfigParser' )
393
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
379
394
@mock .patch .object (api , 'XMLRPC' )
380
395
@mock .patch .object (patches , 'action_get' )
381
396
def test_get__no_ids (mock_action , mock_api , mock_config , capsys ):
@@ -392,6 +407,7 @@ def test_get__no_ids(mock_action, mock_api, mock_config, capsys):
392
407
393
408
394
409
@mock .patch .object (utils .configparser , 'ConfigParser' )
410
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
395
411
@mock .patch .object (api , 'XMLRPC' )
396
412
@mock .patch .object (patches , 'action_apply' )
397
413
def test_git_am__no_args (mock_action , mock_api , mock_config ):
@@ -421,6 +437,7 @@ def test_git_am__no_args(mock_action, mock_api, mock_config):
421
437
422
438
423
439
@mock .patch .object (utils .configparser , 'ConfigParser' )
440
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
424
441
@mock .patch .object (api , 'XMLRPC' )
425
442
@mock .patch .object (patches , 'action_apply' )
426
443
def test_git_am__threeway_option (mock_action , mock_api , mock_config ):
@@ -435,6 +452,7 @@ def test_git_am__threeway_option(mock_action, mock_api, mock_config):
435
452
436
453
437
454
@mock .patch .object (utils .configparser , 'ConfigParser' )
455
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
438
456
@mock .patch .object (api , 'XMLRPC' )
439
457
@mock .patch .object (patches , 'action_apply' )
440
458
def test_git_am__signoff_option (mock_action , mock_api , mock_config ):
@@ -450,6 +468,7 @@ def test_git_am__signoff_option(mock_action, mock_api, mock_config):
450
468
451
469
452
470
@mock .patch .object (utils .configparser , 'ConfigParser' )
471
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
453
472
@mock .patch .object (api , 'XMLRPC' )
454
473
@mock .patch .object (patches , 'action_apply' )
455
474
def test_git_am__threeway_global_conf (mock_action , mock_api , mock_config ):
@@ -470,6 +489,7 @@ def test_git_am__threeway_global_conf(mock_action, mock_api, mock_config):
470
489
471
490
472
491
@mock .patch .object (utils .configparser , 'ConfigParser' )
492
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
473
493
@mock .patch .object (api , 'XMLRPC' )
474
494
@mock .patch .object (patches , 'action_apply' )
475
495
def test_git_am__signoff_global_conf (mock_action , mock_api , mock_config ):
@@ -491,6 +511,7 @@ def test_git_am__signoff_global_conf(mock_action, mock_api, mock_config):
491
511
492
512
493
513
@mock .patch .object (utils .configparser , 'ConfigParser' )
514
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
494
515
@mock .patch .object (api , 'XMLRPC' )
495
516
@mock .patch .object (patches , 'action_apply' )
496
517
def test_git_am__threeway_project_conf (mock_action , mock_api , mock_config ):
@@ -511,6 +532,7 @@ def test_git_am__threeway_project_conf(mock_action, mock_api, mock_config):
511
532
512
533
513
534
@mock .patch .object (utils .configparser , 'ConfigParser' )
535
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
514
536
@mock .patch .object (api , 'XMLRPC' )
515
537
@mock .patch .object (patches , 'action_apply' )
516
538
def test_git_am__signoff_project_conf (mock_action , mock_api , mock_config ):
@@ -532,6 +554,7 @@ def test_git_am__signoff_project_conf(mock_action, mock_api, mock_config):
532
554
533
555
534
556
@mock .patch .object (utils .configparser , 'ConfigParser' )
557
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
535
558
@mock .patch .object (api , 'XMLRPC' )
536
559
@mock .patch .object (patches , 'action_apply' )
537
560
def test_git_am__failure (mock_action , mock_api , mock_config , capsys ):
@@ -553,6 +576,7 @@ def test_git_am__failure(mock_action, mock_api, mock_config, capsys):
553
576
554
577
555
578
@mock .patch .object (utils .configparser , 'ConfigParser' )
579
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
556
580
@mock .patch .object (api , 'XMLRPC' )
557
581
@mock .patch .object (patches , 'action_info' )
558
582
def test_info (mock_action , mock_api , mock_config ):
@@ -580,6 +604,7 @@ def test_info(mock_action, mock_api, mock_config):
580
604
581
605
582
606
@mock .patch .object (utils .configparser , 'ConfigParser' )
607
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
583
608
@mock .patch .object (api , 'XMLRPC' )
584
609
@mock .patch .object (patches , 'action_list' )
585
610
def test_list__no_options (mock_action , mock_api , mock_config ):
@@ -603,6 +628,7 @@ def test_list__no_options(mock_action, mock_api, mock_config):
603
628
604
629
605
630
@mock .patch .object (utils .configparser , 'ConfigParser' )
631
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
606
632
@mock .patch .object (api , 'XMLRPC' )
607
633
@mock .patch .object (patches , 'action_list' )
608
634
def test_list__state_filter (mock_action , mock_api , mock_config ):
@@ -626,6 +652,7 @@ def test_list__state_filter(mock_action, mock_api, mock_config):
626
652
627
653
628
654
@mock .patch .object (utils .configparser , 'ConfigParser' )
655
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
629
656
@mock .patch .object (api , 'XMLRPC' )
630
657
@mock .patch .object (patches , 'action_list' )
631
658
def test_list__archived_filter (mock_action , mock_api , mock_config ):
@@ -649,6 +676,7 @@ def test_list__archived_filter(mock_action, mock_api, mock_config):
649
676
650
677
651
678
@mock .patch .object (utils .configparser , 'ConfigParser' )
679
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
652
680
@mock .patch .object (api , 'XMLRPC' )
653
681
@mock .patch .object (patches , 'action_list' )
654
682
def test_list__project_filter (mock_action , mock_api , mock_config ):
@@ -678,6 +706,7 @@ def test_list__project_filter(mock_action, mock_api, mock_config):
678
706
679
707
680
708
@mock .patch .object (utils .configparser , 'ConfigParser' )
709
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
681
710
@mock .patch .object (api , 'XMLRPC' )
682
711
@mock .patch .object (patches , 'action_list' )
683
712
def test_list__submitter_filter (mock_action , mock_api , mock_config ):
@@ -701,6 +730,7 @@ def test_list__submitter_filter(mock_action, mock_api, mock_config):
701
730
702
731
703
732
@mock .patch .object (utils .configparser , 'ConfigParser' )
733
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
704
734
@mock .patch .object (api , 'XMLRPC' )
705
735
@mock .patch .object (patches , 'action_list' )
706
736
def test_list__delegate_filter (mock_action , mock_api , mock_config ):
@@ -724,6 +754,7 @@ def test_list__delegate_filter(mock_action, mock_api, mock_config):
724
754
725
755
726
756
@mock .patch .object (utils .configparser , 'ConfigParser' )
757
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
727
758
@mock .patch .object (api , 'XMLRPC' )
728
759
@mock .patch .object (patches , 'action_list' )
729
760
def test_list__msgid_filter (mock_action , mock_api , mock_config ):
@@ -747,6 +778,7 @@ def test_list__msgid_filter(mock_action, mock_api, mock_config):
747
778
748
779
749
780
@mock .patch .object (utils .configparser , 'ConfigParser' )
781
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
750
782
@mock .patch .object (api , 'XMLRPC' )
751
783
@mock .patch .object (patches , 'action_list' )
752
784
def test_list__name_filter (mock_action , mock_api , mock_config ):
@@ -770,6 +802,7 @@ def test_list__name_filter(mock_action, mock_api, mock_config):
770
802
771
803
772
804
@mock .patch .object (utils .configparser , 'ConfigParser' )
805
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
773
806
@mock .patch .object (api , 'XMLRPC' )
774
807
@mock .patch .object (patches , 'action_list' )
775
808
def test_list__limit_filter (mock_action , mock_api , mock_config ):
@@ -793,6 +826,7 @@ def test_list__limit_filter(mock_action, mock_api, mock_config):
793
826
794
827
795
828
@mock .patch .object (utils .configparser , 'ConfigParser' )
829
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
796
830
@mock .patch .object (api , 'XMLRPC' )
797
831
@mock .patch .object (patches , 'action_list' )
798
832
def test_list__limit_reverse_filter (mock_action , mock_api , mock_config ):
@@ -816,6 +850,7 @@ def test_list__limit_reverse_filter(mock_action, mock_api, mock_config):
816
850
817
851
818
852
@mock .patch .object (utils .configparser , 'ConfigParser' )
853
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
819
854
@mock .patch .object (api , 'XMLRPC' )
820
855
@mock .patch .object (patches , 'action_list' )
821
856
def test_list__hash_filter (mock_action , mock_api , mock_config ):
@@ -839,6 +874,7 @@ def test_list__hash_filter(mock_action, mock_api, mock_config):
839
874
840
875
841
876
@mock .patch .object (utils .configparser , 'ConfigParser' )
877
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
842
878
@mock .patch .object (api , 'XMLRPC' )
843
879
@mock .patch .object (projects , 'action_list' )
844
880
def test_projects (mock_action , mock_api , mock_config ):
@@ -850,6 +886,7 @@ def test_projects(mock_action, mock_api, mock_config):
850
886
851
887
852
888
@mock .patch .object (utils .configparser , 'ConfigParser' )
889
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
853
890
@mock .patch .object (api , 'XMLRPC' )
854
891
@mock .patch .object (states , 'action_list' )
855
892
def test_states (mock_action , mock_api , mock_config ):
@@ -861,6 +898,7 @@ def test_states(mock_action, mock_api, mock_config):
861
898
862
899
863
900
@mock .patch .object (utils .configparser , 'ConfigParser' )
901
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
864
902
@mock .patch .object (api , 'XMLRPC' )
865
903
@mock .patch .object (patches , 'action_update' )
866
904
def test_update__no_options (
@@ -888,6 +926,7 @@ def test_update__no_options(
888
926
889
927
890
928
@mock .patch .object (utils .configparser , 'ConfigParser' )
929
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
891
930
@mock .patch .object (api , 'XMLRPC' )
892
931
@mock .patch .object (patches , 'action_update' )
893
932
def test_update__no_auth (
@@ -908,6 +947,7 @@ def test_update__no_auth(
908
947
909
948
910
949
@mock .patch .object (utils .configparser , 'ConfigParser' )
950
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
911
951
@mock .patch .object (api , 'XMLRPC' )
912
952
@mock .patch .object (patches , 'action_update' )
913
953
def test_update__state_option (mock_action , mock_api , mock_config ):
@@ -932,6 +972,7 @@ def test_update__state_option(mock_action, mock_api, mock_config):
932
972
933
973
934
974
@mock .patch .object (utils .configparser , 'ConfigParser' )
975
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
935
976
@mock .patch .object (api , 'XMLRPC' )
936
977
@mock .patch .object (patches , 'action_update' )
937
978
def test_update__archive_option (mock_action , mock_api , mock_config ):
@@ -952,6 +993,7 @@ def test_update__archive_option(mock_action, mock_api, mock_config):
952
993
953
994
954
995
@mock .patch .object (utils .configparser , 'ConfigParser' )
996
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
955
997
@mock .patch .object (api , 'XMLRPC' )
956
998
@mock .patch .object (patches , 'action_update' )
957
999
def test_update__commitref_option (mock_action , mock_api , mock_config ):
@@ -976,6 +1018,7 @@ def test_update__commitref_option(mock_action, mock_api, mock_config):
976
1018
977
1019
978
1020
@mock .patch .object (utils .configparser , 'ConfigParser' )
1021
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
979
1022
@mock .patch .object (api , 'XMLRPC' )
980
1023
@mock .patch .object (patches , 'action_update' )
981
1024
def test_update__commitref_with_multiple_patches (
@@ -1002,17 +1045,14 @@ def test_update__commitref_with_multiple_patches(
1002
1045
assert 'Declining update with COMMIT-REF on multiple IDs' in captured .err
1003
1046
1004
1047
1005
- @mock .patch .object (patches , 'action_view' )
1006
1048
@mock .patch .object (utils .configparser , 'ConfigParser' )
1049
+ @mock .patch .object (shell .os .path , 'exists' , new = mock .Mock (return_value = True ))
1007
1050
@mock .patch .object (api , 'XMLRPC' )
1008
- def test_view (mock_api , mock_config , mock_view , capsys ):
1009
- fake_config = FakeConfig ()
1010
-
1011
- mock_config .return_value = fake_config
1051
+ @mock .patch .object (patches , 'action_view' )
1052
+ def test_view (mock_action , mock_api , mock_config , capsys ):
1053
+ mock_config .return_value = FakeConfig ()
1012
1054
mock_api .return_value .patch_get_mbox .return_value = 'foo'
1013
1055
1014
- # test firstly with a single patch ID
1015
-
1016
1056
shell .main (['view' , '1' ])
1017
1057
1018
- mock_view .assert_called_once_with (mock_api .return_value , [1 ])
1058
+ mock_action .assert_called_once_with (mock_api .return_value , [1 ])
0 commit comments