'Ensure specific password history is created for all users.'

def test_set_history_force(self):

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