示例#1
0
 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'
示例#2
0
 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''
示例#3
0
 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''
示例#4
0
 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''
示例#5
0
 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''
示例#6
0
 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''
示例#7
0
 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''
示例#8
0
 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'
示例#9
0
 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''
示例#10
0
 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''
示例#11
0
 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)
示例#12
0
 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''
示例#13
0
 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''
示例#14
0
 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''
示例#15
0
 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)
示例#16
0
 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''