00001
00002
00003 PKG='cob_powercube_chain'
00004 import roslib; roslib.load_manifest(PKG)
00005
00006 import sys
00007 import unittest
00008
00009 import rospy
00010
00011 class APITest(unittest.TestCase):
00012 def __init__(self, *args):
00013 super(APITest, self).__init__(*args)
00014 rospy.init_node("test_api_node")
00015 self.namespace = rospy.get_namespace()
00016
00017 def test_service_api(self):
00018 rospy.wait_for_service('init',10)
00019 rospy.wait_for_service('stop',10)
00020 rospy.wait_for_service('recover',10)
00021 rospy.wait_for_service('set_operation_mode',10)
00022
00023 def test_topic_api(self):
00024 topic_list = rospy.get_published_topics()
00025
00026
00027
00028 topic_check_list = []
00029 topic_check_list.append(['/joint_states','sensor_msgs/JointState'])
00030 topic_check_list.append([self.namespace + 'state','pr2_controllers_msgs/JointTrajectoryControllerState'])
00031 topic_check_list.append([self.namespace + 'joint_trajectory_action/feedback','pr2_controllers_msgs/JointTrajectoryActionFeedback'])
00032 topic_check_list.append([self.namespace + 'joint_trajectory_action/result','pr2_controllers_msgs/JointTrajectoryActionResult'])
00033 topic_check_list.append([self.namespace + 'joint_trajectory_action/status','actionlib_msgs/GoalStatusArray'])
00034
00035
00036 for L in topic_check_list:
00037 if not L in topic_list:
00038 self.assertTrue(False, L[0] + ' not in topic_list')
00039
00040 if __name__ == '__main__':
00041 import rostest
00042 rostest.rosrun(PKG, 'api_test', APITest)