'Ensure password history is created.'

def test_set_history(self):

    self.assertFalse(self.user.password_history.all())
    password_age = 5
    out = StringIO()
    call_command('user_password_history', '--days={}'.format(password_age), stdout=out)
    user = self.UserModel.objects.get(username='patrick')
    password_history = user.password_history.all()
    self.assertEqual(password_history.count(), 1)
    self.assertIn('Password    history    set    to    ', out.getvalue())
    self.assertIn('for    {}    users'.format(1), out.getvalue())
