def test_create_new_platform_user_and_request_cognitive_test_then_cleanup(self): #create user ros_service = rospy.get_param("rapp_mysql_wrapper_create_new_platform_user_service_topic") rospy.wait_for_service(ros_service) test_service = rospy.ServiceProxy(ros_service, createNewPlatformUserSrv) req = createNewPlatformUserSrvRequest() req.username="******" req.password="******" req.language="el" req.creator_username="******" response = test_service(req) self.assertTrue(response.success) #request test ros_service = rospy.get_param("rapp_cognitive_exercise_chooser_topic") rospy.wait_for_service(ros_service) test_service = rospy.ServiceProxy(\ ros_service, testSelectorSrv) req = testSelectorSrvRequest() req.username="******" req.testType="ArithmeticCts" response = test_service(req) self.assertEqual(response.success, True) self.assertEqual(len(response.questions)>=1, True) #get user's ontology alias ros_service = rospy.get_param("rapp_mysql_wrapper_get_user_ontology_alias_service_topic") rospy.wait_for_service(ros_service) test_service = rospy.ServiceProxy(\ ros_service, getUserOntologyAliasSrv) req = getUserOntologyAliasSrvRequest() req.username="******" response = test_service(req) self.assertEqual(response.success, True) ontology_alias=response.ontology_alias #retract user's ontology alias ros_service = rospy.get_param("rapp_knowrob_wrapper_retract_user_ontology_alias") rospy.wait_for_service(ros_service) test_service = rospy.ServiceProxy(\ ros_service, retractUserOntologyAliasSrv) req = retractUserOntologyAliasSrvRequest() req.ontology_alias=ontology_alias response = test_service(req) self.assertEqual(response.success, True) #remove user ros_service = rospy.get_param("rapp_mysql_wrapper_remove_platform_user_service_topic") rospy.wait_for_service(ros_service) test_service = rospy.ServiceProxy(ros_service, removePlatformUserSrv) req = removePlatformUserSrvRequest() req.username="******" response = test_service(req) self.assertTrue(response.success)
def test_chooser_no_type(self): ros_service = rospy.get_param(\ "rapp_cognitive_exercise_chooser_topic") rospy.wait_for_service(ros_service) test_service = rospy.ServiceProxy(\ ros_service, testSelectorSrv) req = testSelectorSrvRequest() req.username = "******" req.testType = "" response = test_service(req) self.assertEqual(response.success, True)
def test_chooser_no_type(self): ros_service = rospy.get_param(\ "rapp_cognitive_exercise_chooser_topic") rospy.wait_for_service(ros_service) test_service = rospy.ServiceProxy(\ ros_service, testSelectorSrv) req = testSelectorSrvRequest() req.username="******" req.testType="" response = test_service(req) self.assertEqual(response.success, True)
def test_chooser_basic(self): subclasses_of_service = rospy.get_param(\ "rapp_cognitive_exercise_chooser_topic") rospy.wait_for_service(subclasses_of_service) test_service = rospy.ServiceProxy(\ subclasses_of_service, testSelectorSrv) req = testSelectorSrvRequest() req.username="******" req.testType="ArithmeticCts" response = test_service(req) self.assertEqual(response.success, True)
def test_chooser_basic(self): subclasses_of_service = rospy.get_param(\ "rapp_cognitive_exercise_chooser_topic") rospy.wait_for_service(subclasses_of_service) test_service = rospy.ServiceProxy(\ subclasses_of_service, testSelectorSrv) req = testSelectorSrvRequest() req.username = "******" req.testType = "ArithmeticCts" response = test_service(req) self.assertEqual(response.success, True)
def test_chooser_subtype(self): ros_service = rospy.get_param(\ "rapp_cognitive_exercise_chooser_topic") rospy.wait_for_service(ros_service) test_service = rospy.ServiceProxy(\ ros_service, testSelectorSrv) req = testSelectorSrvRequest() req.username = "******" req.testType = "ArithmeticCts" req.testSubType = "BasicArithmeticCts" response = test_service(req) self.assertEqual(response.success, True) self.assertEqual(len(response.questions) >= 1, True) self.assertEqual(response.testSubType, "BasicArithmeticCts")
def test_chooser_subtype(self): ros_service = rospy.get_param(\ "rapp_cognitive_exercise_chooser_topic") rospy.wait_for_service(ros_service) test_service = rospy.ServiceProxy(\ ros_service, testSelectorSrv) req = testSelectorSrvRequest() req.username="******" req.testType="ArithmeticCts" req.testSubType="BasicArithmeticCts" response = test_service(req) self.assertEqual(response.success, True) self.assertEqual(len(response.questions)>=1, True) self.assertEqual(response.testSubType, "BasicArithmeticCts")
def test_chooser_parameters_provided(self): ros_service = rospy.get_param(\ "rapp_cognitive_exercise_chooser_topic") rospy.wait_for_service(ros_service) test_service = rospy.ServiceProxy(\ ros_service, testSelectorSrv) req = testSelectorSrvRequest() req.username = "******" req.testType = "ArithmeticCts" req.testSubType = "BasicArithmeticCts" req.testDifficulty = "1" req.testIndex = "1" response = test_service(req) self.assertEqual(response.success, True) self.assertEqual(len(response.questions) >= 1, True) self.assertEqual(response.test, "ArithmeticCts_bneXbLGX")
def test_chooser_parameters_provided(self): ros_service = rospy.get_param(\ "rapp_cognitive_exercise_chooser_topic") rospy.wait_for_service(ros_service) test_service = rospy.ServiceProxy(\ ros_service, testSelectorSrv) req = testSelectorSrvRequest() req.username="******" req.testType="ArithmeticCts" req.testSubType="BasicArithmeticCts" req.testDifficulty="1" req.testIndex="1" response = test_service(req) self.assertEqual(response.success, True) self.assertEqual(len(response.questions)>=1, True) self.assertEqual(response.test,"ArithmeticCts_bneXbLGX")
def test_create_new_platform_user_and_request_cognitive_test_then_cleanup( self): #create user ros_service = rospy.get_param( "rapp_mysql_wrapper_create_new_platform_user_service_topic") rospy.wait_for_service(ros_service) test_service = rospy.ServiceProxy(ros_service, createNewPlatformUserSrv) req = createNewPlatformUserSrvRequest() req.username = "******" req.password = "******" req.language = "el" req.creator_username = "******" response = test_service(req) self.assertTrue(response.success) #request test ros_service = rospy.get_param("rapp_cognitive_exercise_chooser_topic") rospy.wait_for_service(ros_service) test_service = rospy.ServiceProxy(\ ros_service, testSelectorSrv) req = testSelectorSrvRequest() req.username = "******" req.testType = "ArithmeticCts" response = test_service(req) self.assertEqual(response.success, True) self.assertEqual(len(response.questions) >= 1, True) #get user's ontology alias ros_service = rospy.get_param( "rapp_mysql_wrapper_get_user_ontology_alias_service_topic") rospy.wait_for_service(ros_service) test_service = rospy.ServiceProxy(\ ros_service, getUserOntologyAliasSrv) req = getUserOntologyAliasSrvRequest() req.username = "******" response = test_service(req) self.assertEqual(response.success, True) ontology_alias = response.ontology_alias #retract user's ontology alias ros_service = rospy.get_param( "rapp_knowrob_wrapper_retract_user_ontology_alias") rospy.wait_for_service(ros_service) test_service = rospy.ServiceProxy(\ ros_service, retractUserOntologyAliasSrv) req = retractUserOntologyAliasSrvRequest() req.ontology_alias = ontology_alias response = test_service(req) self.assertEqual(response.success, True) #remove user ros_service = rospy.get_param( "rapp_mysql_wrapper_remove_platform_user_service_topic") rospy.wait_for_service(ros_service) test_service = rospy.ServiceProxy(ros_service, removePlatformUserSrv) req = removePlatformUserSrvRequest() req.username = "******" response = test_service(req) self.assertTrue(response.success)