create and use get, update, delete instead of old

deleteParams, deleteSingleParam -> delete
getParams -> get
saveParams -> update
This commit is contained in:
Doug Bell 2010-10-28 21:03:18 -05:00
parent 2554a45a15
commit fa73d81251
11 changed files with 214 additions and 145 deletions

View file

@ -55,11 +55,11 @@ $user->update({
username => "Andy Dufresne",
});
my $auth = $user->authInstance;
$auth->saveParams( $user->getId, $user->get('authMethod'), {
$auth->update(
ldapUrl => $ldapProps->{ldapUrl},
connectDN => "uid=Andy Dufresne,o=shawshank",
ldapConnection => $ldapProps->{ldapLinkId},
} );
);
$session->request->setup_body({
username => 'Andy Dufresne',
@ -134,7 +134,7 @@ $auth = WebGUI::Auth::LDAP->new( $session, 'LDAP' );
$out = $auth->login;
is $session->user->get('username'), 'Brooks Hatley', 'Brooks was created';
cmp_deeply(
$auth->getParams,
$auth->get,
{
connectDN => 'uid=Brooks Hatley,o=shawshank',
ldapConnection => '00000000000000testlink',
@ -167,7 +167,7 @@ $auth = WebGUI::Auth::LDAP->new( $session, 'LDAP' );
$out = $auth->login;
is $session->user->get('username'), 'Brooks Hatley', 'Brooks was logged in after name change';
cmp_deeply(
$auth->getParams,
$auth->get,
{
connectDN => 'uid=Brooks Hatlen,o=shawshank',
ldapConnection => '00000000000000testlink',

View file

@ -88,8 +88,9 @@ my $userId = $session->db->quickScalar(
"SELECT userId FROM authentication WHERE authMethod=? AND fieldName=? AND fieldData=?",
[ "Twitter", "twitterUserId", "2345" ],
);
ok( $userId, 'user exists in authentication table' );
$user = WebGUI::User->new( $session, $userId );
note( $userId );
isnt( $user->userId, 1, 'user exists in authentication table' );
is( $user->username, "RedHerring", "correct username is set" );
WebGUI::Test->addToCleanup( $user );

View file

@ -47,9 +47,9 @@ WebGUI::Test->addToCleanup($user);
$user->username( $USERNAME );
$user->addToGroups( ['3'] );
my $auth = WebGUI::Operation::Auth::getInstance( $session, $user->authMethod, $user->userId );
$auth->saveParams( $user->userId, $user->authMethod, {
$auth->update(
'identifier' => $auth->hashPassword($IDENTIFIER)
});
);
my ($redirect, $response, $url);
@ -115,8 +115,6 @@ $mech->get_ok( $assetUrl . "?op=auth;method=displayLogin" );
$mech->submit_form_ok(
{
with_fields => {
op => 'auth',
method => 'login',
username => $USERNAME,
identifier => $IDENTIFIER,
},