1<?php 2/* 3 * To change this template, choose Tools | Templates 4 * and open the template in the editor. 5 */ 6 7/** 8 * Description of jsonrpc_test 9 * 10 * @author mwolf 11 */ 12require_once ('../jsonrpc.php'); 13 14class jsonrpc_test extends UnitTestCase{ 15 16 function testChecAuthAllowAll() 17 { 18 global $conf; 19 global $USERINFO; 20 21 $conf['plugin']['jsonrpc']['allow_all'] = 1; 22 $this->assertTrue(checkAuth(), "Failure checkAuth, allow_all"); 23 } 24 25 function testAuthCheckAllowUser() 26 { 27 $conf['plugin']['jsonrpc']['allow_all'] = 0; 28 $conf['plugin']['jsonrpc']['allowed'] = 'testuser'; 29 $_SERVER['REMOTE_USER'] = 'testuser'; 30 31 $this->assertTrue(checkAuth(), "Failer checkAuth, allow testuser"); 32 } 33 34 function testAuthCheckNotAllowed() 35 { 36 $conf['plugin']['jsonrpc']['allow_all'] = 0; 37 $conf['plugin']['jsonrpc']['allowed'] = ''; 38 39 $_SERVER['REMOTE_USER'] = 'testuser'; 40 41 $this->assertFalse(checkAuth(), "Failer checkAuth, notallow testuser"); 42 } 43 44} 45 46?> 47