diff options
author | Ivan Kohler <ivan@freeside.biz> | 2014-05-27 15:20:05 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2014-05-27 15:20:05 -0700 |
commit | c5922713bc199600bc8c203155a4016c9d24cbbc (patch) | |
tree | 1b9ec8323fdab801c4ca6aaf74234bfe8f74c56c /rt/t/api | |
parent | 7c841dec307feed06ee532ac18e4114ef68243a8 (diff) |
rt 4.0.20 (RT#13852)
Diffstat (limited to 'rt/t/api')
-rw-r--r-- | rt/t/api/date.t | 10 | ||||
-rw-r--r-- | rt/t/api/password-types.t | 11 |
2 files changed, 20 insertions, 1 deletions
diff --git a/rt/t/api/date.t b/rt/t/api/date.t index cc1c694cc..22c6f1b58 100644 --- a/rt/t/api/date.t +++ b/rt/t/api/date.t @@ -4,7 +4,7 @@ use DateTime; use warnings; use strict; -use RT::Test tests => 173; +use RT::Test tests => 175; use RT::User; use Test::Warn; @@ -440,6 +440,14 @@ my $year = (localtime(time))[5] + 1900; $date->Unix(0); $date->AddDays(31); is($date->ISO, '1970-02-01 00:00:00', "added one month"); + + $date->Unix(0); + $date->AddDays(0); + is($date->ISO, '1970-01-01 00:00:00', "added no days"); + + $date->Unix(0); + $date->AddDays(); + is($date->ISO, '1970-01-02 00:00:00', "added one day with no argument"); } { diff --git a/rt/t/api/password-types.t b/rt/t/api/password-types.t index e5155e35b..10a874a3d 100644 --- a/rt/t/api/password-types.t +++ b/rt/t/api/password-types.t @@ -3,6 +3,8 @@ use warnings; use RT::Test; use Digest::MD5; +use Encode 'encode_utf8'; +use utf8; my $default = "sha512"; @@ -38,3 +40,12 @@ my $trunc = MIME::Base64::encode_base64( $root->_Set( Field => "Password", Value => $trunc); ok($root->IsPassword("secret"), "Unsalted MD5 base64 works"); like($root->__Value("Password"), qr/^\!$default\!/, "And is now upgraded to salted $default"); + +# Non-ASCII salted truncated SHA-256 +my $non_ascii_trunc = MIME::Base64::encode_base64( + "salt" . substr(Digest::SHA::sha256("salt".Digest::MD5::md5(encode_utf8("áěšý"))),0,26), + "" +); +$root->_Set( Field => "Password", Value => $non_ascii_trunc); +ok($root->IsPassword("áěšý"), "Unsalted MD5 base64 works"); +like($root->__Value("Password"), qr/^\!$default\!/, "And is now upgraded to salted $default"); |