From c5922713bc199600bc8c203155a4016c9d24cbbc Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 27 May 2014 15:20:05 -0700 Subject: rt 4.0.20 (RT#13852) --- rt/t/api/date.t | 10 +++++++++- rt/t/api/password-types.t | 11 +++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'rt/t/api') 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"); -- cgit v1.2.1