diff --git a/dynamic_initial_data/base.py b/dynamic_initial_data/base.py index 2ee9d0f..d98016e 100644 --- a/dynamic_initial_data/base.py +++ b/dynamic_initial_data/base.py @@ -140,8 +140,9 @@ def update_app(self, app, handle_deletions=True): self.updated_apps.add(app) # Handle deletions if necessary, this could be a single call that was nat batched with multiple updates - if handle_deletions: - self.handle_deletions() + # We cannot handle this case yet since we do not know what app registered what deletions + # if handle_deletions: + # self.handle_deletions() def handle_deletions(self): """ diff --git a/dynamic_initial_data/tests/integration_tests.py b/dynamic_initial_data/tests/integration_tests.py index ac5c517..927e500 100644 --- a/dynamic_initial_data/tests/integration_tests.py +++ b/dynamic_initial_data/tests/integration_tests.py @@ -211,44 +211,3 @@ def update_initial_data(self): self.assertEquals(Account.objects.count(), 1) self.assertEquals(RegisteredForDeletionReceipt.objects.count(), 1) self.assertEquals(RegisteredForDeletionReceipt.objects.get().model_obj.name, 'hi') - - def test_handle_deletions_when_update_app_is_called(self): - """ - Tests handling of deletions and updates when they are registered from the update_initial_data function. And we - only update a single application and not all - """ - class AccountInitialData1(BaseInitialData): - """ - The initial data code the first time it is called. It registers two accounts for deletion - by returning it from the update_initial_data function. - """ - def update_initial_data(self): - # Register two account objects for deletion - self.register_for_deletion( - Account.objects.get_or_create(name='hi')[0], Account.objects.get_or_create(name='hi2')[0]) - - class AccountInitialData2(BaseInitialData): - """ - The initial data code the second time it is called. It only manages one of the previous accounts - """ - def update_initial_data(self): - self.register_for_deletion(Account.objects.get_or_create(name='hi')[0]) - - # Verify no account objects exist - self.assertEquals(Account.objects.count(), 0) - - with patch.object(InitialDataUpdater, 'load_app', return_value=AccountInitialData1): - InitialDataUpdater().update_app('test') - - # Verify two account objects were created and are managed by deletion receipts - self.assertEquals(Account.objects.count(), 2) - self.assertEquals(RegisteredForDeletionReceipt.objects.count(), 2) - - # Run the initial data process again, this time deleting the account named 'hi2' - with patch.object(InitialDataUpdater, 'load_app', return_value=AccountInitialData2): - InitialDataUpdater().update_app('test') - - # Verify only the 'hi' account exists - self.assertEquals(Account.objects.count(), 1) - self.assertEquals(RegisteredForDeletionReceipt.objects.count(), 1) - self.assertEquals(RegisteredForDeletionReceipt.objects.get().model_obj.name, 'hi') diff --git a/dynamic_initial_data/version.py b/dynamic_initial_data/version.py index 45869b6..ed7d50e 100644 --- a/dynamic_initial_data/version.py +++ b/dynamic_initial_data/version.py @@ -1 +1 @@ -__version__ = '0.5.2' +__version__ = '0.5.3'