Skip to content

SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.

Add tests

Brendan Coles42c24af462be
diff --git a/test/bandit b/test/bandit
new file mode 100755
index 00000000..b3ffb6af
--- /dev/null
+++ b/test/bandit
@@ -0,0 +1,2 @@
+#!/bin/sh
+python3 -m bandit *.py modules/*.py
diff --git a/test/dlint b/test/dlint
new file mode 100755
index 00000000..a639c0e2
--- /dev/null
+++ b/test/dlint
@@ -0,0 +1,2 @@
+#!/bin/sh
+python3 -m flake8 --select=DUO *.py modules/*.py
diff --git a/test/test_pep8.py b/test/test_pep8.py
new file mode 100644
index 00000000..4ab9bb51
--- /dev/null
+++ b/test/test_pep8.py
@@ -0,0 +1,21 @@
+# https://pep8.readthedocs.io/en/latest/advanced.html
+import os
+import unittest
+import pycodestyle
+
+class TestPep8(unittest.TestCase):
+ """Run PEP8 on all files in this directory and subdirectories."""
+ def test_pep8(self):
+ style = pycodestyle.StyleGuide(quiet=False)
+ style.options.max_line_length = 200
+ #style.options.ignore += ('W',)
+
+ filenames = []
+ for root, _, files in os.walk('.'):
+ python_files = [f for f in files if f.endswith('.py')]
+ for file in python_files:
+ filename = '{0}/{1}'.format(root, file)
+ filenames.append(filename)
+
+ check = style.check_files(filenames)
+ self.assertEqual(check.total_errors, 0, 'Found %d code style errors and warnings' % check.total_errors)