enabled tests

code cleaned
added exceptions

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@801 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
sala
2014-03-24 16:20:41 +00:00
parent 87407b5529
commit 7dccc4fc1a
2 changed files with 60 additions and 59 deletions

View File

@@ -72,12 +72,32 @@ public:
RestHelper rest ;
rest.init("localhost",8080);
std::string answer;
std::cout << "---- REST test 1: true, string "<< std::endl;
int code = rest.get_json("status", &answer);
std::cout << "Answer: " << answer << std::endl;
//JsonBox::Value json_value;
//code = rest.get_json("status", &json_value);
//std::cout << "JSON " << json_value["status"] << std::endl;
std::cout << "---- REST test 2: 404, string "<< std::endl;
code = rest.get_json("statuss", &answer);
if (code != 0){
//throw -1;
std::cout << "I SHOULD THROW AN EXCEPTION!!!" << std::endl;
}
std::cout << "---- REST test 3: true, json object "<< std::endl;
JsonBox::Value json_value;
code = rest.get_json("status", &json_value);
std::cout << "JSON " << json_value["status"] << std::endl;
RestHelper rest2 ;
rest2.init("reallyfake",8080);
std::cout << "---- REST test 4: host not found, json object "<< std::endl;
JsonBox::Value json_value2;
code = rest2.get_json("status", &json_value2);
if (code != 0){
//throw -1;
std::cout << "I SHOULD THROW AN EXCEPTION!!!" << std::endl;
}
}