'Logout should send user_logged_out signal if custom user was logged in.'

@override_settings(AUTH_USER_MODEL=u'test_client_regress.CustomUser')
def test_logout_with_custom_user(self):

    def listener(*args, **kwargs):
        self.assertEqual(kwargs[u'sender'], CustomUser)
        listener.executed = True
    listener.executed = False
    u = CustomUser.custom_objects.create(email=u'test@test.com')
    u.set_password(u'password')
    u.save()
    user_logged_out.connect(listener)
    self.client.login(username=u'test@test.com', password=u'password')
    self.client.logout()
    user_logged_out.disconnect(listener)
    self.assertTrue(listener.executed)
