def test_set_setting_should_set_setting(self, mock_VideoCapture): mock_video_capture = mock_VideoCapture.return_value mock_video_capture.get.return_value = 1.0 expected_image = Mock() expected_image.shape = (10, 20, 3) mock_video_capture.read.return_value = (True, expected_image) camera = Camera() camera.start() camera.set_setting('Hue', 1.0) mock_video_capture.set.assert_called_once_with(cv2.CAP_PROP_HUE, 1.0)
def test_set_setting_should_raise_exception_if_setting_not_in_list( self, mock_VideoCapture): mock_video_capture = mock_VideoCapture.return_value mock_video_capture.get.return_value = 1.0 expected_image = Mock() expected_image.shape = (10, 20, 3) mock_video_capture.read.return_value = (True, expected_image) camera = Camera() camera.start() with self.assertRaises(Exception): camera.set_setting('Pizza', 1.0)
def test_set_setting_should_raise_exception_if_camera_not_started( self, mock_VideoCapture): camera = Camera() with self.assertRaises(Exception): camera.set_setting('Hue', '1.0')