Beispiel #1
0
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
Beispiel #2
0
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
Beispiel #3
0
 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
Beispiel #4
0
 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
Beispiel #5
0
 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
Beispiel #6
0
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
Beispiel #7
0
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
Beispiel #8
0
 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()
Beispiel #9
0
 def test_capture_nodevices(self):
     cli.getch = Mock(return_value=' ')
     cli.get_devices = Mock(return_value=[])
     cli.capture()
Beispiel #10
0
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
Beispiel #11
0
 def test_capture_nodevices(self):
     cli.getch = Mock(return_value=' ')
     cli.get_devices = Mock(return_value=[])
     cli.capture()
Beispiel #12
0
 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)
Beispiel #13
0
 def test_capture_nodevices(self):
     cli.getch = Mock(return_value=' ')
     self.workflow.devices = []
     with pytest.raises(DeviceException) as excinfo:
         cli.capture(self.workflow)
Beispiel #14
0
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
Beispiel #15
0
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
Beispiel #16
0
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
Beispiel #17
0
 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()