File tests/api.sh changed (mode: 100755) (index 9f7b33f..4938aca) |
3 |
3 |
user="catab" |
user="catab" |
4 |
4 |
key="925cb5896280c6f132263336a5e90819" |
key="925cb5896280c6f132263336a5e90819" |
5 |
5 |
curl --header "Authorization: ${user} ${key}" \ |
curl --header "Authorization: ${user} ${key}" \ |
6 |
|
--include \ |
|
7 |
6 |
--data "{\"cmd\": \"user_info\", \"user\": \"${user}\"}" \ |
--data "{\"cmd\": \"user_info\", \"user\": \"${user}\"}" \ |
|
7 |
|
-o api.out \ |
8 |
8 |
http://rg:9000/op/api |
http://rg:9000/op/api |
|
9 |
|
json_verify < api.out |
|
10 |
|
if [ "${?}" != "0" ]; then |
|
11 |
|
echo "JSON seems to not be ok!" |
|
12 |
|
exit 1 |
|
13 |
|
fi |
File tests/http.inc.php changed (mode: 100644) (index c8410af..01923e2) |
... |
... |
function test_login($url, $rg_ui, &$good_sid) |
212 |
212 |
return FALSE; |
return FALSE; |
213 |
213 |
} |
} |
214 |
214 |
$good_sid = $r['sid']; |
$good_sid = $r['sid']; |
|
215 |
|
if (empty($good_sid)) { |
|
216 |
|
rg_log('Empty good_sid!'); |
|
217 |
|
return FALSE; |
|
218 |
|
} |
215 |
219 |
|
|
216 |
220 |
if (strstr($r['body'], "invalid user")) { |
if (strstr($r['body'], "invalid user")) { |
217 |
221 |
rg_log_ml(print_r($r, TRUE)); |
rg_log_ml(print_r($r, TRUE)); |
File tests/keys.php changed (mode: 100644) (index e092a10..3909a36) |
... |
... |
if ($c === FALSE) { |
59 |
59 |
exit(1); |
exit(1); |
60 |
60 |
} |
} |
61 |
61 |
$e = "command=\"" |
$e = "command=\"" |
62 |
|
. $rg_scripts . "/scripts/remote.sh 1 $key_id1\"," |
|
|
62 |
|
. $rg_scripts . "/scripts/remote.sh 1 $key_id1 N\"," |
63 |
63 |
. $rg_ssh_paras . ' ' . $key1 . "\n" |
. $rg_ssh_paras . ' ' . $key1 . "\n" |
64 |
64 |
. "command=\"" |
. "command=\"" |
65 |
|
. $rg_scripts . "/scripts/remote.sh 2 $key_id2\"," |
|
|
65 |
|
. $rg_scripts . "/scripts/remote.sh 2 $key_id2 N\"," |
66 |
66 |
. $rg_ssh_paras . ' ' . $key2 . "\n"; |
. $rg_ssh_paras . ' ' . $key2 . "\n"; |
67 |
67 |
if (strcmp($c, $e) != 0) { |
if (strcmp($c, $e) != 0) { |
68 |
68 |
rg_log("Generated file does not seems OK!"); |
rg_log("Generated file does not seems OK!"); |
File tests/rights.php changed (mode: 100644) (index 707a4d1..5df61ae) |
... |
... |
rg_log(''); |
108 |
108 |
rg_log("Testing rg_rights_get..."); |
rg_log("Testing rg_rights_get..."); |
109 |
109 |
$right_id = 0; |
$right_id = 0; |
110 |
110 |
$r = rg_rights_get($db, $a['obj_id'], "type1", $a['who'], $a['uid'], $right_id); |
$r = rg_rights_get($db, $a['obj_id'], "type1", $a['who'], $a['uid'], $right_id); |
111 |
|
if (($r['ok'] !== 1) || (strcmp($r['list'][1]['rights'], "d") != 0)) { |
|
112 |
|
rg_log("Seems I cannot get rights (" . rg_rights_error() . ")"); |
|
|
111 |
|
if (($r['ok'] !== 1) || empty($r['list']) |
|
112 |
|
|| (strcmp($r['list'][1]['rights'], "d") != 0)) { |
113 |
113 |
rg_log_ml("r: " . print_r($r, TRUE)); |
rg_log_ml("r: " . print_r($r, TRUE)); |
|
114 |
|
rg_log("Seems I cannot get rights (" . rg_rights_error() . ")"); |
114 |
115 |
exit (1); |
exit (1); |
115 |
116 |
} |
} |
116 |
117 |
// 'get' again, to see if cache works |
// 'get' again, to see if cache works |
117 |
118 |
$r = rg_rights_get($db, $a['obj_id'], "type1", $a['who'], $a['uid'], $right_id); |
$r = rg_rights_get($db, $a['obj_id'], "type1", $a['who'], $a['uid'], $right_id); |
118 |
|
if (($r['ok'] !== 1) || (strcmp($r['list'][1]['rights'], "d") != 0)) { |
|
|
119 |
|
if (($r['ok'] !== 1) || empty($r['list']) |
|
120 |
|
|| (strcmp($r['list'][1]['rights'], "d") != 0)) { |
119 |
121 |
rg_log("Seems I cannot get rights (" . rg_rights_error() . ")"); |
rg_log("Seems I cannot get rights (" . rg_rights_error() . ")"); |
120 |
122 |
rg_log_ml("r: " . print_r($r, TRUE)); |
rg_log_ml("r: " . print_r($r, TRUE)); |
121 |
123 |
exit(1); |
exit(1); |
File tests/wh_http.php changed (mode: 100644) (index c9517bb..85daba0) |
... |
... |
$data = array( 'delete' => 1, |
356 |
356 |
'token' => $good_token, |
'token' => $good_token, |
357 |
357 |
'delete_list[' . $wh_id1 . ']' => 'on'); |
'delete_list[' . $wh_id1 . ']' => 'on'); |
358 |
358 |
$r = do_req($test_url . "/op/settings/wh/list", $data, $headers); |
$r = do_req($test_url . "/op/settings/wh/list", $data, $headers); |
359 |
|
if (!strstr($r['body'], 'deleted with success')) { |
|
|
359 |
|
if (!strstr($r['body'], 'success')) { |
360 |
360 |
rg_log_ml('r[body]: ' . print_r($r['body'], TRUE)); |
rg_log_ml('r[body]: ' . print_r($r['body'], TRUE)); |
361 |
361 |
rg_log("Cannot delete webhook!"); |
rg_log("Cannot delete webhook!"); |
362 |
362 |
exit(1); |
exit(1); |