Ejemplo n.º 1
0
 def test_control_interface_check_fail_ImproperlyConfigured(self):
     camera_type = CameraType(name='axis',
                              driver='apps.cam.drivers.axis.AxisDriver')
     camera = Camera(type=camera_type)
     control_interface = camera.driver.control
     self.failUnlessRaises(drivers.exceptions.ImproperlyConfigured,
                           control_interface.check)
Ejemplo n.º 2
0
 def test_control_interface_command(self):
     camera_type = CameraType(name='axis',
                              driver='apps.cam.drivers.axis.AxisDriver')
     camera = Camera(type=camera_type,
                     host=AXIS_CAMERA_HOST,
                     username=AXIS_CAMERA_USER,
                     password=AXIS_CAMERA_PASSWORD)
     control_interface = camera.driver.control
     control_interface.reset()
Ejemplo n.º 3
0
    def test_control_interface_check_success(self):
        camera_type = CameraType(name='axis',
                                 driver='apps.cam.drivers.axis.AxisDriver')
        camera = Camera(type=camera_type,
                        host=AXIS_CAMERA_HOST,
                        username=AXIS_CAMERA_USER,
                        password=AXIS_CAMERA_PASSWORD)
        control_interface = camera.driver.control

        self.failUnless(control_interface.check())
Ejemplo n.º 4
0
 def test_control_interface_check_fail_AccessDenied(self):
     camera_type = CameraType(name='axis',
                              driver='apps.cam.drivers.axis.AxisDriver')
     camera = Camera(type=camera_type,
                     host=AXIS_CAMERA_HOST,
                     username=AXIS_CAMERA_USER,
                     password='******')
     control_interface = camera.driver.control
     self.failUnlessRaises(drivers.exceptions.AccessDenied,
                           control_interface.check)
Ejemplo n.º 5
0
 def test_interfaces_instantiation(self):
     camera_type = CameraType(name='axis',
                              driver='apps.cam.drivers.axis.AxisDriver')
     camera = Camera(type=camera_type)
     self.failUnless(
         isinstance(camera.driver.stream,
                    apps.cam.drivers.axis.AxisStreamInterface))
     self.failUnless(
         isinstance(camera.driver.control,
                    apps.cam.drivers.axis.AxisControlInterface))
Ejemplo n.º 6
0
    def test_control_interface_authenticate(self):
        camera_type = CameraType(name='axis',
                                 driver='apps.cam.drivers.axis.AxisDriver')
        camera = Camera(type=camera_type,
                        host=AXIS_CAMERA_HOST,
                        username=AXIS_CAMERA_USER,
                        password=AXIS_CAMERA_PASSWORD)
        control_interface = camera.driver.control

        self.failUnless(
            isinstance(control_interface.authenticate(), mechanize.Browser))
Ejemplo n.º 7
0
    def test_stream_interface(self):
        camera_type = CameraType(name='axis',
                                 driver='apps.cam.drivers.axis.AxisDriver')
        camera = Camera(type=camera_type)
        stream_interface = camera.driver.stream
        for method in (
                'check',
                'enable',
                'disable',
        ):
            self.failUnless(hasattr(stream_interface, method),
                            'stream interface has not method %s' % method)

            self.failUnless(
                callable(getattr(stream_interface, method)),
                'stream interface method %s is not callable' % method)
Ejemplo n.º 8
0
    def test_control_interface(self):
        camera_type = CameraType(name='axis',
                                 driver='apps.cam.drivers.axis.AxisDriver')
        camera = Camera(type=camera_type)
        control_interface = camera.driver.control
        for method in (
                'check',
                'zoom_in',
                'zoom_out',
                'move_up',
                'move_down',
                'move_left',
                'move_right',
                'home',
                'reset',
        ):
            self.failUnless(hasattr(control_interface, method),
                            'control interface has not method %s' % method)

            self.failUnless(
                callable(getattr(control_interface, method)),
                'control interface method %s is not callable' % method)
Ejemplo n.º 9
0
 def test_driver_class_instantiation(self):
     camera_type = CameraType(name='axis',
                              driver='apps.cam.drivers.axis.AxisDriver')
     camera = Camera(type=camera_type)
     self.failUnless(
         isinstance(camera.driver, apps.cam.drivers.axis.AxisDriver))