From e9adcde4648b54db8d40f314ca938dca5080bb9c Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Fri, 15 Sep 2017 14:30:40 -0400 Subject: Bug 1391702 - Replace Bugzilla::User::validate_password() with calls to Data::Password::passwdqc --- t/903-passwdqc-conf.t | 23 +++++++++++++++++++++++ t/bmo/passwords.t | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 t/903-passwdqc-conf.t (limited to 't') diff --git a/t/903-passwdqc-conf.t b/t/903-passwdqc-conf.t new file mode 100644 index 000000000..fe7ce9b53 --- /dev/null +++ b/t/903-passwdqc-conf.t @@ -0,0 +1,23 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. +use 5.10.1; +use strict; +use warnings; +use autodie; + +use Test::More 1.302; +use ok 'Bugzilla::Config::Auth'; + +ok(length(Bugzilla::Config::Auth::_check_passwdqc_min("undef, 24, 11, 8, 7")) == 0, "default value is valid"); +ok(length(Bugzilla::Config::Auth::_check_passwdqc_min("underf, 24, 11, 8, 7")) != 0, "underf is not valid"); +is(Bugzilla::Config::Auth::_check_passwdqc_min("undef, 24, 25, 8, 7"), "Int2 is larger than Int1 (24)", "25 can't come after 24"); +ok(length(Bugzilla::Config::Auth::_check_passwdqc_min("")) != 0, "empty string is invalid"); +ok(length(Bugzilla::Config::Auth::_check_passwdqc_min("24")) != 0, "24 is invalid"); +ok(length(Bugzilla::Config::Auth::_check_passwdqc_min("-24")) != 0, "-24 is invalid"); +ok(length(Bugzilla::Config::Auth::_check_passwdqc_min("10, 10, 10, 10, 0")) != 0, "10, 10, 10, 10, 0 is invalid"); + +done_testing; diff --git a/t/bmo/passwords.t b/t/bmo/passwords.t index d10eddff7..249cdfb3c 100644 --- a/t/bmo/passwords.t +++ b/t/bmo/passwords.t @@ -12,7 +12,7 @@ BEGIN { plan skip_all => "these tests only run in CI" unless $ENV{CI} && $ENV{CI use ok DRIVER; my $ADMIN_LOGIN = $ENV{BZ_TEST_ADMIN} // 'admin@mozilla.bugs'; -my $ADMIN_PW_OLD = $ENV{BZ_TEST_ADMIN_PASS} // 'passWord1234!'; +my $ADMIN_PW_OLD = $ENV{BZ_TEST_ADMIN_PASS} // 'Te6Oovohch'; my $ADMIN_PW_NEW = $ENV{BZ_TEST_ADMIN_NEWPASS} // 'she7Ka8t'; my @require_env = qw( @@ -33,7 +33,7 @@ eval { login_ok($sel, $ADMIN_LOGIN, $ADMIN_PW_OLD); - change_password($sel, $ADMIN_PW_OLD, 'newpassword', 'newpassword2'); + change_password($sel, $ADMIN_PW_OLD, 'Ju9shiePhie6', 'zeeKuj0leib7'); $sel->title_is("Passwords Don't Match"); $sel->body_text_contains('The two passwords you entered did not match.'); -- cgit v1.2.3-24-g4f1b