another updateuser privatekey test

This commit is contained in:
Christian Weiske 2011-04-11 17:00:44 +02:00
parent d06924c662
commit ae828e9d78
2 changed files with 29 additions and 1 deletions

View File

@ -854,7 +854,11 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
}
/**
* Update User Record
* Update user record.
* Updates all values even if they are empty, except passwords.
* An empty password is not set.
*
* No validation is made here.
*
* @param integer $uId User ID
* @param string $password User Password

View File

@ -180,6 +180,30 @@ class UserTest extends TestBase
);
}
/**
* Passing an empty string / NULL as key and disabling it
* should keep no key
*
* @covers SemanticScuttle_Service_User::updateUser
*/
public function testUpdateUserPrivateKeyExistingKeyEnabled()
{
$pkey = '12345678901234567890123456789012';
$uid = $this->addUser();
$this->assertTrue(
$this->us->updateUser(
$uid, 'password', 'name', 'test@example.org', '', '',
'-' . $pkey, true
)
);
$arUser = $this->us->getUser($uid);
$this->assertInternalType('array', $arUser);
$this->assertEquals(
$pkey, $arUser['privateKey'], 'private key was not enabled'
);
}
//FIXME: verify I cannot re-use private key of different user