-
Notifications
You must be signed in to change notification settings - Fork 5
Description
hi ,
I think it might be an issue for creating a test plan via rest api.
below is my url and the json to be posted.
http://localhost/testlink1914/lib/api/rest/v2/testplans
{"active":1,"is_public":"0","name":"11111","testProjectID":1,"notes":"iamnotes"}
And this is the response.
{"status":"ok","message":"Undefined variable: api_key"}
I debugged and added one line code to function createFromObject in "testplan.class.php"
/**
*
*/
function createFromObject($item,$opt=null)
{
$debugMsg = 'Class:' . CLASS . ' - Method: ' . FUNCTION;
$my['opt'] = array('doChecks' => false, 'setSessionProject' => true);
$my['opt'] = array_merge($my['opt'],(array)$opt);
$api_key = md5(rand()) . md5(rand()); // added by me
try
{
// mandatory checks
if(strlen($item->name)==0)
{
throw new Exception('Empty name is not allowed');
}
Then it works.
http://localhost/testlink1914/lib/api/rest/v2/testplans
{"active":1,"is_public":"0","name":"111111","testProjectID":1,"notes":"iamnotes"}
{"status":"ok","message":"ok","id":"8"}