def test_capture_no_target_page(config, mock_driver_mgr, mock_plugin_mgr, tmpdir): config['path'] = unicode(tmpdir) mock_driver_mgr.return_value.driver.target_pages = False with pytest.raises(DeviceException): cli.capture(config) mock_driver_mgr.return_value.driver.target_pages = True
def test_capture(tty, termios, stdin, select, config, capsys, tmpdir): select.return_value = ([stdin], [], []) stdin.read.side_effect = chain(repeat('b', 3), 'r', 'f') config['path'] = unicode(tmpdir) cli.capture(config) assert stdin.read.call_count == 5 last_status = capsys.readouterr()[0].split('\r')[-1] assert " 6 pages " in last_status
def test_capture(self): cli.getch = Mock(side_effect=chain(repeat('b', 3), 'c')) cli.get_devices = Mock(return_value=self.devices) cli.capture() assert cli.getch.call_count == 4 assert cli.workflow.prepare_capture.call_count == 1 assert cli.workflow.capture.call_count == 3 assert cli.workflow.finish_capture.call_count == 1
def test_capture(self): self.workflow.config['capture']['capture_keys'] = ["b", " "] cli.getch = Mock(side_effect=chain(repeat('b', 3), 'f')) cli.capture(self.workflow) assert cli.getch.call_count == 4 assert self.workflow.prepare_capture.call_count == 1 assert self.workflow.capture.call_count == 3 assert self.workflow.finish_capture.call_count == 1
def test_capture_nodevices(config, mock_driver_mgr, mock_plugin_mgr, tmpdir): config['path'] = unicode(tmpdir) mock_driver_mgr.return_value.driver.num_devices = 0 with pytest.raises(DeviceException): cli.capture(config) mock_driver_mgr.return_value.driver.num_devices = 2
def test_capture_noorientation(self): self.devices[0].orientation = None cli.getch = Mock(return_value='c') cli.get_devices = Mock(return_value=self.devices) cli.capture()
def test_capture_nodevices(self): cli.getch = Mock(return_value=' ') cli.get_devices = Mock(return_value=[]) cli.capture()
def test_capture_nodevices(config, tmpdir): config['path'] = unicode(tmpdir) TestDriver.num_devices = 0 with pytest.raises(DeviceException): cli.capture(config) TestDriver.num_devices = 2
def test_capture_no_target_page(self): self.workflow.devices[0].target_page = None cli.getch = Mock(return_value='c') with pytest.raises(DeviceException) as excinfo: cli.capture(self.workflow)
def test_capture_nodevices(self): cli.getch = Mock(return_value=' ') self.workflow.devices = [] with pytest.raises(DeviceException) as excinfo: cli.capture(self.workflow)
def test_capture_no_target_page(config, tmpdir): config['path'] = unicode(tmpdir) TestDriver.target_pages = False with pytest.raises(DeviceException): cli.capture(config) TestDriver.target_pages = True