def test_with_password(capsys, settings):
    settings.DEBUG = True

    generate_password = Command()
    generate_password.run_from_argv(['manage.py', 'set_fake_passwords', '--password=helloworld'])
    out, err = capsys.readouterr()
    assert 'Reset 3 passwords' in out

    for user in User.objects.all():
        assert user.check_password("helloworld")
def test_without_args(capsys, settings):
    settings.DEBUG = True

    old_passwords = User.objects.values_list('password', flat=True).order_by('id')
    assert len(set(old_passwords)) == 3

    generate_password = Command()
    generate_password.run_from_argv(['manage.py', 'set_fake_passwords'])
    out, err = capsys.readouterr()
    assert 'Reset 3 passwords' in out

    new_passwords = User.objects.values_list('password', flat=True).order_by('id')
    assert len(set(new_passwords)) == 1
    assert old_passwords != new_passwords

    for user in User.objects.all():
        assert user.check_password(DEFAULT_FAKE_PASSWORD)