summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2009-01-25 15:46:48 +0100
committerAndreas Gohr <andi@splitbrain.org>2009-01-25 15:46:48 +0100
commit30506cef7e42d95d7444431298106632d4fbf90f (patch)
treee2d328c2bad0b50e33c01f5f2dc8bde006c80260
parentcd3c835dbeb780145f9ea9830a3385893f62d613 (diff)
downloadrpg-30506cef7e42d95d7444431298106632d4fbf90f.tar.gz
rpg-30506cef7e42d95d7444431298106632d4fbf90f.tar.bz2
added missing unit test to repository
Ignore-this: d1c6f55bfb7edcdb40c6b69a219d8291 darcs-hash:20090125144648-7ad00-94e0d4a6b153f193841317851cb3d6e8f2744cb0.gz
-rw-r--r--_test/cases/inc/auth_password.test.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/_test/cases/inc/auth_password.test.php b/_test/cases/inc/auth_password.test.php
new file mode 100644
index 000000000..1ba731c7e
--- /dev/null
+++ b/_test/cases/inc/auth_password.test.php
@@ -0,0 +1,43 @@
+<?php
+
+require_once DOKU_INC.'inc/init.php';
+require_once DOKU_INC.'inc/auth.php';
+
+class auth_password_test extends UnitTestCase {
+
+ // hashes for the password foo$method, using abcdefgh as salt
+ var $passes = array(
+ 'smd5' => '$1$abcdefgh$SYbjm2AEvSoHG7Xapi8so.',
+ 'apr1' => '$apr1$abcdefgh$C/GzYTF4kOVByYLEoD5X4.',
+ 'md5' => '8fa22d62408e5351553acdd91c6b7003',
+ 'sha1' => 'b456d3b0efd105d613744ffd549514ecafcfc7e1',
+ 'ssha' => '{SSHA}QMHG+uC7bHNYKkmoLbNsNI38/dJhYmNk',
+ 'crypt' => 'ablvoGr1hvZ5k',
+ 'mysql' => '4a1fa3780bd6fd55',
+ 'my411' => '*e5929347e25f82e19e4ebe92f1dc6b6e7c2dbd29',
+ );
+
+
+ function test_cryptPassword(){
+ foreach($this->passes as $method => $hash){
+ $info = "testing method $method";
+ $this->signal('failinfo',$info);
+ $this->assertEqual(auth_cryptPassword('foo'.$method,$method,'abcdefgh'),$hash);
+ }
+ }
+
+ function test_verifyPassword(){
+ foreach($this->passes as $method => $hash){
+ $info = "testing method $method";
+ $this->signal('failinfo',$info);
+ $this->assertTrue(auth_verifyPassword('foo'.$method,$hash));
+ }
+ }
+
+ function test_verifyPassword_nohash(){
+ $this->assertTrue(auth_verifyPassword('foo','$1$$n1rTiFE0nRifwV/43bVon/'));
+ }
+
+}
+
+//Setup VIM: ex: et ts=4 enc=utf-8 :