def test_scan_invalid_device(self): # we detect missing devices when scanning cmd = FPScanCommand(self.fpscan_path, ['-s', '--no-device', ]) cmd.run() ret_code, stdout, stderr = cmd.wait() assert ret_code == 1 assert stdout == b'' assert stderr == b'Invalid device number: 0.\n'
def test_detect_fail(self): # we can detect missing devices cmd = FPScanCommand(self.fpscan_path, ['--no-device', ]) cmd.run() ret_code, stdout, stderr = cmd.wait() assert ret_code == 0 assert stdout == b'0\n' assert stderr == b''
def test_detect_ok(self): # we can detect devices cmd = FPScanCommand(self.fpscan_path) cmd.run() ret_code, stdout, stderr = cmd.wait() assert ret_code == 0 assert stdout == (b'Digital Persona U.are.U 4000/4000B/4500\n' b' 2 0 1 0 1 384 290\n') assert stderr == b''
def test_scan_fail(self): # scans can fail. We respect that cmd = FPScanCommand(self.fpscan_path, ['-s', '--scan-fail', ]) cmd.run() ret_code, stdout, stderr = cmd.wait() assert cmd.is_alive() is False assert ret_code == 1 assert stdout == b'fail\n' assert stderr == b''
def test_compare_ok(self): # we can compare input with stored fingerprints stored_path = self.create_fake_data_fpm() cmd = FPScanCommand(self.fpscan_path, ['-c', '-i', stored_path]) cmd.run() ret_code, stdout, stderr = cmd.wait() assert cmd.is_alive() is False assert ret_code == 0 assert stdout == b'ok\n' assert stderr == b''
def test_detect_fail(self): # we can detect missing devices cmd = FPScanCommand(self.fpscan_path, [ '--no-device', ]) cmd.run() ret_code, stdout, stderr = cmd.wait() assert ret_code == 0 assert stdout == b'0\n' assert stderr == b''
def test_detect_ok(self): # we can detect devices cmd = FPScanCommand(self.fpscan_path) cmd.run() ret_code, stdout, stderr = cmd.wait() assert ret_code == 0 assert stdout == ( b'Digital Persona U.are.U 4000/4000B/4500\n' b' 2 0 1 0 1 384 290\n') assert stderr == b''
def test_compare_fail(self): # we can detect failing comparisons by exit status stored_path = self.create_fake_data_fpm() cmd = FPScanCommand(self.fpscan_path, ['-c', '-i', stored_path, '--compare-fail']) cmd.run() ret_code, stdout, stderr = cmd.wait() assert cmd.is_alive() is False assert ret_code == 1 assert stdout == b'error: unknown reason\n' assert stderr == b''
def test_compare_no_match(self): # we can detect non-matches when comparing fingerprints stored_path = self.create_fake_data_fpm() cmd = FPScanCommand(self.fpscan_path, ['-c', '-i', stored_path, '--compare-no-match']) cmd.run() ret_code, stdout, stderr = cmd.wait() assert cmd.is_alive() is False assert ret_code == 0 assert stdout == b'no-match\n' assert stderr == b''
def test_scan_invalid_device(self): # we detect missing devices when scanning cmd = FPScanCommand(self.fpscan_path, [ '-s', '--no-device', ]) cmd.run() ret_code, stdout, stderr = cmd.wait() assert ret_code == 1 assert stdout == b'' assert stderr == b'Invalid device number: 0.\n'
def test_scan_ok(self): # we can scan fingerprints (emulated) out_path = os.path.join(self.home_dir, 'data.fpm') cmd = FPScanCommand(self.fpscan_path, ['-s', '-o', out_path]) cmd.run() ret_code, stdout, stderr = cmd.wait() assert cmd.is_alive() is False assert ret_code == 0 assert stdout == b'ok\n' assert stderr == b'' assert os.path.exists(out_path)
def test_compare_fail(self): # we can detect failing comparisons by exit status stored_path = self.create_fake_data_fpm() cmd = FPScanCommand( self.fpscan_path, ['-c', '-i', stored_path, '--compare-fail']) cmd.run() ret_code, stdout, stderr = cmd.wait() assert cmd.is_alive() is False assert ret_code == 1 assert stdout == b'error: unknown reason\n' assert stderr == b''
def test_compare_no_match(self): # we can detect non-matches when comparing fingerprints stored_path = self.create_fake_data_fpm() cmd = FPScanCommand( self.fpscan_path, ['-c', '-i', stored_path, '--compare-no-match']) cmd.run() ret_code, stdout, stderr = cmd.wait() assert cmd.is_alive() is False assert ret_code == 0 assert stdout == b'no-match\n' assert stderr == b''
def test_scan_fail(self): # scans can fail. We respect that cmd = FPScanCommand(self.fpscan_path, [ '-s', '--scan-fail', ]) cmd.run() ret_code, stdout, stderr = cmd.wait() assert cmd.is_alive() is False assert ret_code == 1 assert stdout == b'fail\n' assert stderr == b''