Merge "tests related to API block action and its gettoken"
This commit is contained in:
commit
a521673dc2
1 changed files with 46 additions and 0 deletions
|
|
@ -68,4 +68,50 @@ class ApiBlockTest extends ApiTestCase {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideBlockUnblockAction
|
||||
*/
|
||||
function testGetTokenUsingABlockingAction( $action ) {
|
||||
$data = $this->doApiRequest(
|
||||
array(
|
||||
'action' => $action,
|
||||
'user' => 'UTApiBlockee',
|
||||
'gettoken' => '' ),
|
||||
null,
|
||||
false,
|
||||
self::$users['sysop']->user
|
||||
);
|
||||
$this->assertEquals( 34, strlen( $data[0][$action]["{$action}token"] ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempting to block without a token should give a UsageException with
|
||||
* error message:
|
||||
* "The token parameter must be set"
|
||||
*
|
||||
* @dataProvider provideBlockUnblockAction
|
||||
* @expectedException UsageException
|
||||
*/
|
||||
function testBlockingActionWithNoToken( $action ) {
|
||||
$this->doApiRequest(
|
||||
array(
|
||||
'action' => $action,
|
||||
'user' => 'UTApiBlockee',
|
||||
'reason' => 'Some reason',
|
||||
),
|
||||
null,
|
||||
false,
|
||||
self::$users['sysop']->user
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Just provide the 'block' and 'unblock' action to test both API calls
|
||||
*/
|
||||
function provideBlockUnblockAction() {
|
||||
return array(
|
||||
array( 'block' ),
|
||||
array( 'unblock' ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue