示例#1
0
 def test_converted_signal(self):
     # The `converted` signal should be dispatched when a user is
     # successfully converted.
     user, username = LazyUser.objects.create_lazy_user()
     d = {
         'username': '******',
         'password1': 'password',
         'password2': 'password',
     }
     form = GoodUserCreationForm(d, instance=user)
     # setup signal
     self.handled = False
     def handler(sender, **kwargs):
         self.assertEqual(kwargs['user'], user)
         self.handled = True
     converted.connect(handler)
     # convert user
     user = LazyUser.objects.convert(form)
     # check signal
     self.assertTrue(self.handled)
示例#2
0
    def test_converted_signal(self):
        # The `converted` signal should be dispatched when a user is
        # successfully converted.
        user, username = LazyUser.objects.create_lazy_user()
        d = {
            'username': '******',
            'password1': 'password',
            'password2': 'password',
        }
        form = GoodUserCreationForm(d, instance=user)
        # setup signal
        self.handled = False

        def handler(sender, **kwargs):
            self.assertEqual(kwargs['user'], user)
            self.handled = True

        converted.connect(handler)
        # convert user
        user = LazyUser.objects.convert(form)
        # check signal
        self.assertTrue(self.handled)
示例#3
0
    def test_converted_signal(self):
        """
        The ``converted`` signal should be dispatched when a user is
        successfully converted.
        """
        user, username = LazyUser.objects.create_lazy_user()
        d = {
            "username": "******",
            "password1": "password",
            "password2": "password",
        }
        form = GoodUserCreationForm(d, instance=user)
        # setup signal
        self.handled = False

        def handler(sender, **kwargs):
            self.assertEqual(kwargs["user"], user)
            self.handled = True

        converted.connect(handler)
        # convert user
        user = LazyUser.objects.convert(form)
        # check signal
        self.assertTrue(self.handled)