@@ -211,44 +211,3 @@ def update_initial_data(self):
211211 self .assertEquals (Account .objects .count (), 1 )
212212 self .assertEquals (RegisteredForDeletionReceipt .objects .count (), 1 )
213213 self .assertEquals (RegisteredForDeletionReceipt .objects .get ().model_obj .name , 'hi' )
214-
215- def test_handle_deletions_when_update_app_is_called (self ):
216- """
217- Tests handling of deletions and updates when they are registered from the update_initial_data function. And we
218- only update a single application and not all
219- """
220- class AccountInitialData1 (BaseInitialData ):
221- """
222- The initial data code the first time it is called. It registers two accounts for deletion
223- by returning it from the update_initial_data function.
224- """
225- def update_initial_data (self ):
226- # Register two account objects for deletion
227- self .register_for_deletion (
228- Account .objects .get_or_create (name = 'hi' )[0 ], Account .objects .get_or_create (name = 'hi2' )[0 ])
229-
230- class AccountInitialData2 (BaseInitialData ):
231- """
232- The initial data code the second time it is called. It only manages one of the previous accounts
233- """
234- def update_initial_data (self ):
235- self .register_for_deletion (Account .objects .get_or_create (name = 'hi' )[0 ])
236-
237- # Verify no account objects exist
238- self .assertEquals (Account .objects .count (), 0 )
239-
240- with patch .object (InitialDataUpdater , 'load_app' , return_value = AccountInitialData1 ):
241- InitialDataUpdater ().update_app ('test' )
242-
243- # Verify two account objects were created and are managed by deletion receipts
244- self .assertEquals (Account .objects .count (), 2 )
245- self .assertEquals (RegisteredForDeletionReceipt .objects .count (), 2 )
246-
247- # Run the initial data process again, this time deleting the account named 'hi2'
248- with patch .object (InitialDataUpdater , 'load_app' , return_value = AccountInitialData2 ):
249- InitialDataUpdater ().update_app ('test' )
250-
251- # Verify only the 'hi' account exists
252- self .assertEquals (Account .objects .count (), 1 )
253- self .assertEquals (RegisteredForDeletionReceipt .objects .count (), 1 )
254- self .assertEquals (RegisteredForDeletionReceipt .objects .get ().model_obj .name , 'hi' )
0 commit comments