'Test clearsessions command for clearing expired sessions.'

def test_clearsessions_command(self):

    self.assertEqual(0, self.model.objects.count())
    self.session['foo'] = 'bar'
    self.session.set_expiry(3600)
    self.session.save()
    other_session = self.backend()
    other_session['foo'] = 'bar'
    other_session.set_expiry((-3600))
    other_session.save()
    self.assertEqual(2, self.model.objects.count())
    with override_settings(SESSION_ENGINE=self.session_engine):
        management.call_command('clearsessions')
    self.assertEqual(1, self.model.objects.count())
