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

def test_logout_with_user(self):

    def listener(*args, **kwargs):
        listener.executed = True
        self.assertEqual(kwargs[u'sender'], User)
    listener.executed = False
    user_logged_out.connect(listener)
    self.client.login(username=u'testclient', password=u'password')
    self.client.logout()
    user_logged_out.disconnect(listener)
    self.assertTrue(listener.executed)
