class HazardDetectionTests(unittest.TestCase):

    def setUp(self): 
        rospack = rospkg.RosPack()
        self.pkgDir = rospack.get_path('rapp_testing_tools')
        
        self.ch = RappPlatformAPI()

    def test_lightLeftOn(self):
        imagepath = path.join(self.pkgDir, 'test_data',
            'hazard_detection_samples', 'lamp_on.jpg')

        response = self.ch.hazardDetectionLights(imagepath)
        
        self.assertEqual(response['error'], u'')
        self.assertEqual(response['light_level'] > 50, True)

    def test_erroneousPath(self):
        imagepath = path.join(self.pkgDir, 'test_data', 'lamp_on.jpg')

        response = self.ch.hazardDetectionLights(imagepath)
        
        self.assertNotEqual(response['error'], u'')

    def test_wrongPathType(self):
        imagepath = 3

        response = self.ch.hazardDetectionLights(imagepath)
        
        self.assertNotEqual(response['error'], u'')
예제 #2
0
class HazardDetectionTests(unittest.TestCase):
    def setUp(self):
        rospack = rospkg.RosPack()
        self.pkgDir = rospack.get_path('rapp_testing_tools')

        self.ch = RappPlatformAPI()

    def test_lightLeftOn(self):
        imagepath = path.join(self.pkgDir, 'test_data',
                              'hazard_detection_samples', 'lamp_on.jpg')

        response = self.ch.hazardDetectionLights(imagepath)

        self.assertEqual(response['error'], u'')
        self.assertEqual(response['light_level'] > 50, True)

    def test_erroneousPath(self):
        imagepath = path.join(self.pkgDir, 'test_data', 'lamp_on.jpg')

        response = self.ch.hazardDetectionLights(imagepath)

        self.assertNotEqual(response['error'], u'')

    def test_wrongPathType(self):
        imagepath = 3

        response = self.ch.hazardDetectionLights(imagepath)

        self.assertNotEqual(response['error'], u'')
예제 #3
0
    def RappLightDetection(self, imageString, image):

        path = imageORimageString(imageString, image)  #path of saved image.
        ch = RappPlatformAPI(address=addr)
        response = ch.hazardDetectionLights(
            path)  # Use the server's path of 	the image.
        return response