Ejemplo n.º 1
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''
Ejemplo n.º 2
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''
Ejemplo n.º 3
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''
Ejemplo n.º 4
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''
Ejemplo n.º 5
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''
Ejemplo n.º 6
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)
Ejemplo n.º 7
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''
Ejemplo n.º 8
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''
Ejemplo n.º 9
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)
Ejemplo n.º 10
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''