Don't cancel wipe out creation records when an object is deleted

This commit is contained in:
jeremystretch 2022-11-11 10:41:50 -05:00
parent b57616e9ce
commit d6f1e18192
2 changed files with 0 additions and 25 deletions

View File

@ -143,12 +143,6 @@ class checkout:
key = self.get_key_for_instance(instance)
object_type = instance._meta.verbose_name
# Cancel the creation of a new object
if key in self.queue and self.queue[key][0] == ChangeActionChoices.ACTION_CREATE:
logger.debug(f"[{self.branch}] Removing staged creation of {object_type} {instance} (PK: {instance.pk})")
del self.queue[key]
return
# Delete an existing object
logger.debug(f"[{self.branch}] Staging deletion of {object_type} {instance} (PK: {instance.pk})")
self.queue[key] = (ChangeActionChoices.ACTION_DELETE, None)

View File

@ -168,25 +168,6 @@ class StagingTestCase(TransactionTestCase):
self.assertEqual(Circuit.objects.count(), 6)
self.assertEqual(Change.objects.count(), 0)
def test_create_update_delete_clean(self):
branch = Branch.objects.create(name='Branch 1')
with checkout(branch):
# Create a new object
provider = Provider.objects.create(name='Provider D', slug='provider-d')
provider.save()
# Update it
provider.comments = 'Another change'
provider.save()
# Delete it
provider.delete()
# Check that the staged Change has been deleted
self.assertFalse(Change.objects.exists())
def test_exit_enter_context(self):
branch = Branch.objects.create(name='Branch 1')