summaryrefslogtreecommitdiff
path: root/tests/signals
diff options
context:
space:
mode:
authorAlex Hill <alex@hill.net.au>2016-06-01 00:17:25 +0800
committerTim Graham <timograham@gmail.com>2016-06-02 14:34:01 -0400
commit08014fe75b4fc379523f340191a02147ec35f7a3 (patch)
treea96ad0d39eddcc8ea635562eca27b3bac1acb7a1 /tests/signals
parent2c90981c5f06c0cb3d7a438dd9454ec94fefae17 (diff)
downloaddjango-08014fe75b4fc379523f340191a02147ec35f7a3.tar.gz
Fixed #26686 -- Fixed crash when registering model signals with abstract senders.
Diffstat (limited to 'tests/signals')
-rw-r--r--tests/signals/tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/signals/tests.py b/tests/signals/tests.py
index 6452e138b4..0ed0f85f6b 100644
--- a/tests/signals/tests.py
+++ b/tests/signals/tests.py
@@ -1,5 +1,6 @@
from __future__ import unicode_literals
+from django.apps.registry import Apps
from django.db import models
from django.db.models import signals
from django.dispatch import receiver
@@ -317,3 +318,14 @@ class LazyModelRefTest(BaseSignalTest):
Created()
self.assertEqual(received, [])
+
+ def test_register_model_class_senders_immediately(self):
+ """
+ Model signals registered with model classes as senders don't use the
+ Apps.lazy_model_operation() mechanism.
+ """
+ # Book isn't registered with apps2, so it will linger in
+ # apps2._pending_operations if ModelSignal does the wrong thing.
+ apps2 = Apps()
+ signals.post_init.connect(self.receiver, sender=Book, apps=apps2)
+ self.assertEqual(list(apps2._pending_operations), [])