@@ -709,7 +709,7 @@ def test_create_migration_skip_validation_rejects_empty_policy_name(self):
709709 repository_id = '00000000-0000-0000-0000-000000000000' ,
710710 target_repository = 'https://example.ghe.com/OrgName/RepoName' ,
711711 target_owner_user_id = 'TestOwner' ,
712- skip_validation = 'AgentPoolExists,,MaxRepoSize ' ,
712+ skip_validation = 'AgentPoolExists,,MaxFileSize ' ,
713713 organization = self ._TEST_ORG ,
714714 detect = False
715715 )
@@ -1065,6 +1065,22 @@ def test_pause_returns_migration_data_when_service_responds(self):
10651065
10661066 self .assertEqual (result , migration_response )
10671067
1068+ def test_pause_returns_migration_data_when_service_responds_paused (self ):
1069+ migration_response = {'repositoryId' : '00000000-0000-0000-0000-000000000000' , 'status' : 'paused' }
1070+ with patch ('azext_devops.dev.migration.migration.resolve_instance' ) as mock_resolve , \
1071+ patch ('azext_devops.dev.migration.migration._get_service_client' ) as mock_client , \
1072+ patch ('azext_devops.dev.migration.migration._send_request' ) as mock_send :
1073+ mock_send .return_value = migration_response
1074+ mock_resolve .return_value = self ._TEST_ORG
1075+
1076+ result = pause_migration (
1077+ repository_id = '00000000-0000-0000-0000-000000000000' ,
1078+ organization = self ._TEST_ORG ,
1079+ detect = False
1080+ )
1081+
1082+ self .assertEqual (result , migration_response )
1083+
10681084 def test_list_migrations_warns_when_empty (self ):
10691085 with patch ('azext_devops.dev.migration.migration.resolve_instance' ) as mock_resolve , \
10701086 patch ('azext_devops.dev.migration.migration._get_service_client' ) as mock_client , \
@@ -1160,7 +1176,7 @@ def test_resume_sets_validate_only(self):
11601176
11611177 payload = mock_send .call_args [0 ][3 ]
11621178 self .assertTrue (payload ['validateOnly' ])
1163- self .assertEqual (payload ['statusRequested' ], 'active' )
1179+ self .assertEqual (payload ['statusRequested' ], migration_module . _MIGRATION_STATUS_VALUES [ 'active' ] )
11641180
11651181 def test_resume_sets_migration (self ):
11661182 with patch ('azext_devops.dev.migration.migration.get_migration' ) as mock_get , \
@@ -1177,7 +1193,41 @@ def test_resume_sets_migration(self):
11771193
11781194 payload = mock_send .call_args [0 ][3 ]
11791195 self .assertFalse (payload ['validateOnly' ])
1180- self .assertEqual (payload ['statusRequested' ], 'active' )
1196+ self .assertEqual (payload ['statusRequested' ], migration_module ._MIGRATION_STATUS_VALUES ['active' ])
1197+
1198+ def test_resume_sets_validate_only_when_status_paused (self ):
1199+ with patch ('azext_devops.dev.migration.migration.get_migration' ) as mock_get , \
1200+ patch ('azext_devops.dev.migration.migration.resolve_instance' ) as mock_resolve , \
1201+ patch ('azext_devops.dev.migration.migration._get_service_client' ) as mock_client , \
1202+ patch ('azext_devops.dev.migration.migration._send_request' ) as mock_send :
1203+ mock_send .return_value = {}
1204+ mock_get .return_value = {'status' : 'paused' }
1205+ mock_resolve .return_value = self ._TEST_ORG
1206+
1207+ resume_migration (repository_id = '00000000-0000-0000-0000-000000000000' ,
1208+ validate_only = True ,
1209+ organization = self ._TEST_ORG , detect = False )
1210+
1211+ payload = mock_send .call_args [0 ][3 ]
1212+ self .assertTrue (payload ['validateOnly' ])
1213+ self .assertEqual (payload ['statusRequested' ], migration_module ._MIGRATION_STATUS_VALUES ['active' ])
1214+
1215+ def test_resume_sets_migration_when_status_paused (self ):
1216+ with patch ('azext_devops.dev.migration.migration.get_migration' ) as mock_get , \
1217+ patch ('azext_devops.dev.migration.migration.resolve_instance' ) as mock_resolve , \
1218+ patch ('azext_devops.dev.migration.migration._get_service_client' ) as mock_client , \
1219+ patch ('azext_devops.dev.migration.migration._send_request' ) as mock_send :
1220+ mock_send .return_value = {}
1221+ mock_get .return_value = {'status' : 'paused' }
1222+ mock_resolve .return_value = self ._TEST_ORG
1223+
1224+ resume_migration (repository_id = '00000000-0000-0000-0000-000000000000' ,
1225+ migration = True ,
1226+ organization = self ._TEST_ORG , detect = False )
1227+
1228+ payload = mock_send .call_args [0 ][3 ]
1229+ self .assertFalse (payload ['validateOnly' ])
1230+ self .assertEqual (payload ['statusRequested' ], migration_module ._MIGRATION_STATUS_VALUES ['active' ])
11811231
11821232 def test_resume_without_flags_preserves_mode (self ):
11831233 with patch ('azext_devops.dev.migration.migration.get_migration' ) as mock_get , \
@@ -1193,7 +1243,7 @@ def test_resume_without_flags_preserves_mode(self):
11931243
11941244 payload = mock_send .call_args [0 ][3 ]
11951245 self .assertNotIn ('validateOnly' , payload )
1196- self .assertEqual (payload ['statusRequested' ], 'active' )
1246+ self .assertEqual (payload ['statusRequested' ], migration_module . _MIGRATION_STATUS_VALUES [ 'active' ] )
11971247
11981248 def test_resume_migration_promotes_validate_only_succeeded (self ):
11991249 with patch ('azext_devops.dev.migration.migration.get_migration' ) as mock_get , \
@@ -1215,7 +1265,7 @@ def test_resume_migration_promotes_validate_only_succeeded(self):
12151265 self .assertEqual (args [1 ], 'PUT' )
12161266 payload = args [3 ]
12171267 self .assertFalse (payload ['validateOnly' ])
1218- self .assertEqual (payload ['statusRequested' ], 'active' )
1268+ self .assertEqual (payload ['statusRequested' ], migration_module . _MIGRATION_STATUS_VALUES [ 'active' ] )
12191269
12201270 def test_resume_migration_promotes_validate_only_completed (self ):
12211271 with patch ('azext_devops.dev.migration.migration.get_migration' ) as mock_get , \
@@ -1237,7 +1287,7 @@ def test_resume_migration_promotes_validate_only_completed(self):
12371287 self .assertEqual (args [1 ], 'PUT' )
12381288 payload = args [3 ]
12391289 self .assertFalse (payload ['validateOnly' ])
1240- self .assertEqual (payload ['statusRequested' ], 'active' )
1290+ self .assertEqual (payload ['statusRequested' ], migration_module . _MIGRATION_STATUS_VALUES [ 'active' ] )
12411291
12421292 def test_resume_migration_promote_uses_only_state_transition_fields (self ):
12431293 with patch ('azext_devops.dev.migration.migration.get_migration' ) as mock_get , \
@@ -1262,7 +1312,7 @@ def test_resume_migration_promote_uses_only_state_transition_fields(self):
12621312
12631313 payload = mock_send .call_args [0 ][3 ]
12641314 self .assertEqual (payload ['validateOnly' ], False )
1265- self .assertEqual (payload ['statusRequested' ], 'active' )
1315+ self .assertEqual (payload ['statusRequested' ], migration_module . _MIGRATION_STATUS_VALUES [ 'active' ] )
12661316 self .assertEqual (set (payload .keys ()), {'validateOnly' , 'statusRequested' })
12671317 self .assertNotIn ('agentPoolName' , payload )
12681318 self .assertNotIn ('scheduledCutoverDate' , payload )
0 commit comments