Skip to content

Commit d5b14c3

Browse files
committed
Merge pull request #35 from ambitioninc/develop
Release 0.5.3
2 parents 4a52eff + 0ab2551 commit d5b14c3

File tree

3 files changed

+4
-44
lines changed

3 files changed

+4
-44
lines changed

dynamic_initial_data/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,9 @@ def update_app(self, app, handle_deletions=True):
140140
self.updated_apps.add(app)
141141

142142
# Handle deletions if necessary, this could be a single call that was nat batched with multiple updates
143-
if handle_deletions:
144-
self.handle_deletions()
143+
# We cannot handle this case yet since we do not know what app registered what deletions
144+
# if handle_deletions:
145+
# self.handle_deletions()
145146

146147
def handle_deletions(self):
147148
"""

dynamic_initial_data/tests/integration_tests.py

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -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')

dynamic_initial_data/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.5.2'
1+
__version__ = '0.5.3'

0 commit comments

Comments
 (0)