James Bennett avatar James Bennett committed bc149ae

Move signal tests up to where they belong.

Comments (0)

Files changed (1)

registration/tests.py

         management.call_command('cleanupregistration')
         self.assertEqual(RegistrationProfile.objects.count(), 1)
 
+    def test_signals(self):
+        """
+        Test that the ``user_registered`` and ``user_activated``
+        signals are sent, and that they send the ``User`` as an
+        argument.
+        
+        """
+        def receiver(sender, **kwargs):
+            self.assert_('user' in kwargs)
+            self.assertEqual(kwargs['user'].username, u'signal_test')
+            received_signals.append(kwargs.get('signal'))
+
+        received_signals = []
+        expected_signals = [signals.user_registered, signals.user_activated]
+        for signal in expected_signals:
+            signal.connect(receiver)
+
+        RegistrationProfile.objects.create_inactive_user(username='signal_test',
+                                                         password='foo',
+                                                         email='nobody@example.com',
+                                                         send_email=False)
+        RegistrationProfile.objects.activate_user(RegistrationProfile.objects.get(user__username='signal_test').activation_key)
+
+        self.assertEqual(received_signals, expected_signals)
+
 
 class RegistrationFormTests(RegistrationTestCase):
     """
         form = forms.RegistrationFormNoFreeEmail(data=base_data)
         self.failUnless(form.is_valid())
 
-    def test_signals(self):
-        """
-        Test that the ``user_registered`` and ``user_activated``
-        signals are sent, and that they send the ``User`` as an
-        argument.
-        
-        """
-        def receiver(sender, **kwargs):
-            self.assert_('user' in kwargs)
-            self.assertEqual(kwargs['user'].username, u'signal_test')
-            received_signals.append(kwargs.get('signal'))
-
-        received_signals = []
-        expected_signals = [signals.user_registered, signals.user_activated]
-        for signal in expected_signals:
-            signal.connect(receiver)
-
-        RegistrationProfile.objects.create_inactive_user(username='signal_test',
-                                                         password='foo',
-                                                         email='nobody@example.com',
-                                                         send_email=False)
-        RegistrationProfile.objects.activate_user(RegistrationProfile.objects.get(user__username='signal_test').activation_key)
-
-        self.assertEqual(received_signals, expected_signals)
-
 
 class RegistrationViewTests(RegistrationTestCase):
     """
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.