code
stringlengths 26
870k
| docstring
stringlengths 1
65.6k
| func_name
stringlengths 1
194
| language
stringclasses 1
value | repo
stringlengths 8
68
| path
stringlengths 5
194
| url
stringlengths 46
254
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
def test_do_stop(self):
"""
Test do_stop(self, line)
"""
sfcli = SpiderFootCli()
sfcli.do_stop(None)
self.assertEqual('TBD', 'TBD') | Test do_stop(self, line) | test_do_stop | python | smicallef/spiderfoot | test/unit/test_spiderfootcli.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootcli.py | MIT |
def test_do_search(self):
"""
Test do_search(self, line)
"""
sfcli = SpiderFootCli()
sfcli.do_search(None)
self.assertEqual('TBD', 'TBD') | Test do_search(self, line) | test_do_search | python | smicallef/spiderfoot | test/unit/test_spiderfootcli.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootcli.py | MIT |
def test_do_find(self):
"""
Test do_find(self, line)
"""
sfcli = SpiderFootCli()
sfcli.do_find(None)
self.assertEqual('TBD', 'TBD') | Test do_find(self, line) | test_do_find | python | smicallef/spiderfoot | test/unit/test_spiderfootcli.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootcli.py | MIT |
def test_do_summary(self):
"""
Test do_summary(self, line)
"""
sfcli = SpiderFootCli()
sfcli.do_summary(None)
self.assertEqual('TBD', 'TBD') | Test do_summary(self, line) | test_do_summary | python | smicallef/spiderfoot | test/unit/test_spiderfootcli.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootcli.py | MIT |
def test_do_delete(self):
"""
Test do_delete(self, line)
"""
sfcli = SpiderFootCli()
sfcli.do_delete(None)
self.assertEqual('TBD', 'TBD') | Test do_delete(self, line) | test_do_delete | python | smicallef/spiderfoot | test/unit/test_spiderfootcli.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootcli.py | MIT |
def test_print_topic(self):
"""
Test print_topics(self, header, cmds, cmdlen, maxcol)
"""
sfcli = SpiderFootCli()
io_output = io.StringIO()
sys.stdout = io_output
sfcli.print_topics(None, "help", None, None)
sys.stdout = sys.__stdout__
output = io_output.getvalue()
self.assertIn("Command", output)
self.assertIn("Description", output)
self.assertEqual('TBD', 'TBD') | Test print_topics(self, header, cmds, cmdlen, maxcol) | test_print_topic | python | smicallef/spiderfoot | test/unit/test_spiderfootcli.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootcli.py | MIT |
def test_do_set_should_set_option(self):
"""
Test do_set(self, line)
"""
sfcli = SpiderFootCli()
sfcli.ownopts['cli.test_opt'] = None
sfcli.do_set('cli.test_opt = "test value"')
new_test_opt = sfcli.ownopts['cli.test_opt']
self.assertEqual(new_test_opt, 'test value') | Test do_set(self, line) | test_do_set_should_set_option | python | smicallef/spiderfoot | test/unit/test_spiderfootcli.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootcli.py | MIT |
def test_do_shell(self):
"""
Test do_shell(self, line)
"""
sfcli = SpiderFootCli()
io_output = io.StringIO()
sys.stdout = io_output
sfcli.do_shell("")
sys.stdout = sys.__stdout__
output = io_output.getvalue()
self.assertIn("Running shell command:", output) | Test do_shell(self, line) | test_do_shell | python | smicallef/spiderfoot | test/unit/test_spiderfootcli.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootcli.py | MIT |
def test_do_clear(self):
"""
Test do_clear(self, line)
"""
sfcli = SpiderFootCli()
io_output = io.StringIO()
sys.stderr = io_output
sfcli.do_clear(None)
sys.stderr = sys.__stderr__
output = io_output.getvalue()
self.assertEqual("\x1b[2J\x1b[H", output) | Test do_clear(self, line) | test_do_clear | python | smicallef/spiderfoot | test/unit/test_spiderfootcli.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootcli.py | MIT |
def test_do_exit(self):
"""
Test do_exit(self, line)
"""
sfcli = SpiderFootCli()
do_exit = sfcli.do_exit(None)
self.assertTrue(do_exit) | Test do_exit(self, line) | test_do_exit | python | smicallef/spiderfoot | test/unit/test_spiderfootcli.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootcli.py | MIT |
def test_do_eof(self):
"""
Test do_EOF(self, line)
"""
sfcli = SpiderFootCli()
do_eof = sfcli.do_EOF(None)
self.assertTrue(do_eof) | Test do_EOF(self, line) | test_do_eof | python | smicallef/spiderfoot | test/unit/test_spiderfootcli.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootcli.py | MIT |
def test_init_config_invalid_type_should_raise_TypeError(self):
"""
Test __init__(self, config, web_config)
"""
opts = self.default_options
opts['__modules__'] = dict()
with self.assertRaises(TypeError):
SpiderFootWebUi(None, opts) | Test __init__(self, config, web_config) | test_init_config_invalid_type_should_raise_TypeError | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_init_no_web_config_should_raise(self):
"""
Test __init__(self, config, web_config)
"""
with self.assertRaises(TypeError):
SpiderFootWebUi(self.web_default_options, None)
with self.assertRaises(ValueError):
SpiderFootWebUi(self.web_default_options, dict()) | Test __init__(self, config, web_config) | test_init_no_web_config_should_raise | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_init(self):
"""
Test __init__(self, config)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
self.assertIsInstance(sfwebui, SpiderFootWebUi) | Test __init__(self, config) | test_init | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_error_page(self):
"""
Test error_page(self)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
sfwebui.error_page() | Test error_page(self) | test_error_page | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_error_page_401(self):
"""
Test error_page(self)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
error_page_401 = sfwebui.error_page_401(None, None, None, None)
self.assertIsInstance(error_page_401, str) | Test error_page(self) | test_error_page_401 | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_error_page_404(self):
"""
Test error_page_404(self, status, message, traceback, version)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
error_page_404 = sfwebui.error_page_404(None, None, None, None)
self.assertIsInstance(error_page_404, str) | Test error_page_404(self, status, message, traceback, version) | test_error_page_404 | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_search_base_should_return_a_list(self):
"""
Test searchBase(self, id=None, eventType=None, value=None)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
search_results = sfwebui.searchBase(None, None, None)
self.assertIsInstance(search_results, list)
search_results = sfwebui.searchBase(None, None, "//")
self.assertIsInstance(search_results, list) | Test searchBase(self, id=None, eventType=None, value=None) | test_search_base_should_return_a_list | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_scan_event_result_export_should_return_bytes(self):
"""
Test scaneventresultexport(self, id, type, filetype="csv", dialect="excel")
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
search_results = sfwebui.scaneventresultexport("", "")
self.assertIsInstance(search_results, bytes)
search_results = sfwebui.scaneventresultexport("", "", "excel")
self.assertIsInstance(search_results, bytes) | Test scaneventresultexport(self, id, type, filetype="csv", dialect="excel") | test_scan_event_result_export_should_return_bytes | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_scan_event_result_export_multi(self):
"""
Test scaneventresultexportmulti(self, ids, filetype="csv", dialect="excel")
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
search_results = sfwebui.scaneventresultexportmulti("", "")
self.assertIsInstance(search_results, bytes)
search_results = sfwebui.scaneventresultexportmulti("", "excel")
self.assertIsInstance(search_results, bytes) | Test scaneventresultexportmulti(self, ids, filetype="csv", dialect="excel") | test_scan_event_result_export_multi | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_scan_search_result_export(self):
"""
Test scansearchresultexport(self, id, eventType=None, value=None, filetype="csv", dialect="excel")
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
search_results = sfwebui.scansearchresultexport("")
self.assertIsInstance(search_results, bytes)
search_results = sfwebui.scansearchresultexport("", None, None, "excel")
self.assertIsInstance(search_results, bytes) | Test scansearchresultexport(self, id, eventType=None, value=None, filetype="csv", dialect="excel") | test_scan_search_result_export | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_scan_export_logs_invalid_scan_id_should_return_string(self):
"""
Test scanexportlogs(self: 'SpiderFootWebUi', id: str, dialect: str = "excel") -> str
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
logs = sfwebui.scanexportlogs(None, "excel")
self.assertIsInstance(logs, str)
self.assertIn("Scan ID not found.", logs) | Test scanexportlogs(self: 'SpiderFootWebUi', id: str, dialect: str = "excel") -> str | test_scan_export_logs_invalid_scan_id_should_return_string | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_scan_export_logs_should_return_bytes(self):
"""
Test scanexportlogs(self: 'SpiderFootWebUi', id: str, dialect: str = "excel") -> str
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
logs = sfwebui.scanexportlogs("scan id", "excel")
self.assertIsInstance(logs, bytes) | Test scanexportlogs(self: 'SpiderFootWebUi', id: str, dialect: str = "excel") -> str | test_scan_export_logs_should_return_bytes | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_scan_export_json_multi(self):
"""
Test scanexportjsonmulti(self, ids)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
search_results = sfwebui.scanexportjsonmulti(None)
self.assertIsInstance(search_results, bytes) | Test scanexportjsonmulti(self, ids) | test_scan_export_json_multi | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_scan_viz_should_return_a_string(self):
"""
Test scanviz(self, id, gexf="0")
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
scan_viz = sfwebui.scanviz(None, None)
self.assertIsInstance(scan_viz, str) | Test scanviz(self, id, gexf="0") | test_scan_viz_should_return_a_string | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_scan_viz_multi_should_return_a_string(self):
"""
Test scanvizmulti(self, ids, gexf="1")
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
scan_viz_multi = sfwebui.scanvizmulti(None, None)
self.assertIsInstance(scan_viz_multi, str) | Test scanvizmulti(self, ids, gexf="1") | test_scan_viz_multi_should_return_a_string | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_rerunscanmulti(self):
"""
Test rerunscanmulti(self, ids)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
rerunscanmulti = sfwebui.rerunscanmulti("example scan instance")
self.assertIsInstance(rerunscanmulti, str) | Test rerunscanmulti(self, ids) | test_rerunscanmulti | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_newscan(self):
"""
Test newscan(self)
"""
self.assertEqual('TBD', 'TBD') | Test newscan(self) | test_newscan | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_clonescan(self):
"""
Test clonescan(self, id)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
clone_scan = sfwebui.clonescan("example scan instance")
self.assertIsInstance(clone_scan, str) | Test clonescan(self, id) | test_clonescan | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_index(self):
"""
Test index(self)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
index = sfwebui.index()
self.assertIsInstance(index, str) | Test index(self) | test_index | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_scaninfo(self):
"""
Test scaninfo(self, id)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
scan_info = sfwebui.scaninfo("example scan instance")
self.assertIsInstance(scan_info, str) | Test scaninfo(self, id) | test_scaninfo | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_scandelete_invalid_scanid_should_return_an_error(self):
"""
Test scandelete(self, id)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
scan_delete = sfwebui.scandelete("example scan id")
self.assertIsInstance(scan_delete, dict)
self.assertEqual("Scan example scan id does not exist", scan_delete.get('error').get('message')) | Test scandelete(self, id) | test_scandelete_invalid_scanid_should_return_an_error | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_savesettings_invalid_csrf_token_should_return_an_error(self):
"""
Test savesettings(self, allopts, token, configFile=None)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
save_settings = sfwebui.savesettings(None, "invalid token", None)
self.assertIsInstance(save_settings, str)
self.assertIn("Invalid token", save_settings) | Test savesettings(self, allopts, token, configFile=None) | test_savesettings_invalid_csrf_token_should_return_an_error | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_result_set_fp(self):
"""
Test resultsetfp(self, id, resultids, fp)
"""
self.assertEqual('TBD', 'TBD') | Test resultsetfp(self, id, resultids, fp) | test_result_set_fp | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_ping_should_return_list(self):
"""
Test ping(self)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
ping = sfwebui.ping()
self.assertIsInstance(ping, list)
self.assertEqual(ping[0], 'SUCCESS') | Test ping(self) | test_ping_should_return_list | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_query_should_perform_sql_query(self):
"""
Test query(self, query)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
select = "12345"
query = sfwebui.query(f"SELECT {select}")
self.assertIsInstance(query, list)
self.assertEqual(len(query), 1)
self.assertEqual(str(query[0].get(select)), str(select)) | Test query(self, query) | test_query_should_perform_sql_query | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_query_invalid_query_should_return_error(self):
"""
Test query(self, query)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
query = sfwebui.query(None)
self.assertIsInstance(query, dict)
self.assertEqual("Invalid query.", query.get('error').get('message'))
query = sfwebui.query("UPDATE 1")
self.assertIsInstance(query, dict)
self.assertEqual("Non-SELECTs are unpredictable and not recommended.", query.get('error').get('message')) | Test query(self, query) | test_query_invalid_query_should_return_error | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_start_scan_should_start_a_scan(self):
"""
Test startscan(self, scanname, scantarget, modulelist, typelist, usecase)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
start_scan = sfwebui.startscan('example scan name', 'spiderfoot.net', 'example module list', None, None)
self.assertEqual(start_scan, start_scan)
self.assertEqual('TBD', 'TBD') | Test startscan(self, scanname, scantarget, modulelist, typelist, usecase) | test_start_scan_should_start_a_scan | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_start_scan_invalid_scanname_should_return_error(self):
"""
Test startscan(self, scanname, scantarget, modulelist, typelist, usecase)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
start_scan = sfwebui.startscan(None, 'example scan target', None, None, None)
self.assertIn('Invalid request: scan name was not specified.', start_scan)
start_scan = sfwebui.startscan('', 'example scan target', None, None, None)
self.assertIn('Invalid request: scan name was not specified.', start_scan) | Test startscan(self, scanname, scantarget, modulelist, typelist, usecase) | test_start_scan_invalid_scanname_should_return_error | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_start_scan_invalid_scantarget_should_return_error(self):
"""
Test startscan(self, scanname, scantarget, modulelist, typelist, usecase)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
start_scan = sfwebui.startscan('example scan name', None, None, None, None)
self.assertIn('Invalid request: scan target was not specified.', start_scan)
start_scan = sfwebui.startscan('example scan name', '', None, None, None)
self.assertIn('Invalid request: scan target was not specified.', start_scan) | Test startscan(self, scanname, scantarget, modulelist, typelist, usecase) | test_start_scan_invalid_scantarget_should_return_error | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_start_scan_unrecognized_scantarget_type_should_return_error(self):
"""
Test startscan(self, scanname, scantarget, modulelist, typelist, usecase)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
start_scan = sfwebui.startscan('example scan name', 'example scan target', 'example module list', None, None)
self.assertIn('Invalid target type. Could not recognize it as a target SpiderFoot supports.', start_scan) | Test startscan(self, scanname, scantarget, modulelist, typelist, usecase) | test_start_scan_unrecognized_scantarget_type_should_return_error | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_start_scan_invalid_modules_should_return_error(self):
"""
Test startscan(self, scanname, scantarget, modulelist, typelist, usecase)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
start_scan = sfwebui.startscan('example scan name', 'spiderfoot.net', None, None, None)
self.assertIn('Invalid request: no modules specified for scan.', start_scan)
start_scan = sfwebui.startscan('example scan name', 'spiderfoot.net', '', '', '')
self.assertIn('Invalid request: no modules specified for scan.', start_scan) | Test startscan(self, scanname, scantarget, modulelist, typelist, usecase) | test_start_scan_invalid_modules_should_return_error | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_start_scan_invalid_typelist_should_return_error(self):
"""
Test startscan(self, scanname, scantarget, modulelist, typelist, usecase)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
start_scan = sfwebui.startscan('example scan name', 'spiderfoot.net', None, 'invalid type list', None)
self.assertIn('Invalid request: no modules specified for scan.', start_scan)
start_scan = sfwebui.startscan('example scan name', 'spiderfoot.net', '', 'invalid type list', '')
self.assertIn('Invalid request: no modules specified for scan.', start_scan) | Test startscan(self, scanname, scantarget, modulelist, typelist, usecase) | test_start_scan_invalid_typelist_should_return_error | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_stopscan_invalid_scanid_should_return_an_error(self):
"""
Test stopscan(self, id)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
stop_scan = sfwebui.stopscan("example scan id")
self.assertIsInstance(stop_scan, dict)
self.assertEqual("Scan example scan id does not exist", stop_scan.get('error').get('message')) | Test stopscan(self, id) | test_stopscan_invalid_scanid_should_return_an_error | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_scanlog_should_return_a_list(self):
"""
Test scanlog(self, id, limit=None, rowId=None, reverse=None)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
scan_log = sfwebui.scanlog(None, None, None, None)
self.assertIsInstance(scan_log, list)
scan_log = sfwebui.scanlog('', '', '', '')
self.assertIsInstance(scan_log, list) | Test scanlog(self, id, limit=None, rowId=None, reverse=None) | test_scanlog_should_return_a_list | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_scanerrors_should_return_a_list(self):
"""
Test scanerrors(self, id, limit=None)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
scan_errors = sfwebui.scanerrors(None, None)
self.assertIsInstance(scan_errors, list)
scan_errors = sfwebui.scanerrors('', '')
self.assertIsInstance(scan_errors, list) | Test scanerrors(self, id, limit=None) | test_scanerrors_should_return_a_list | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_scanlist_should_return_a_list(self):
"""
Test scanlist(self)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
scan_list = sfwebui.scanlist()
self.assertIsInstance(scan_list, list) | Test scanlist(self) | test_scanlist_should_return_a_list | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_scanstatus_should_return_a_list(self):
"""
Test scanstatus(self, id)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
scan_status = sfwebui.scanstatus("example scan instance")
self.assertIsInstance(scan_status, list) | Test scanstatus(self, id) | test_scanstatus_should_return_a_list | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_scansummary_should_return_a_list(self):
"""
Test scansummary(self, id, by)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
scan_summary = sfwebui.scansummary(None, None)
self.assertIsInstance(scan_summary, list)
scan_summary = sfwebui.scansummary('', '')
self.assertIsInstance(scan_summary, list) | Test scansummary(self, id, by) | test_scansummary_should_return_a_list | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_scaneventresults_should_return_a_list(self):
"""
Test scaneventresults(self, id, eventType, filterfp=False)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
scan_results = sfwebui.scaneventresults(None, None, None)
self.assertIsInstance(scan_results, list)
scan_results = sfwebui.scaneventresults('', '', '')
self.assertIsInstance(scan_results, list) | Test scaneventresults(self, id, eventType, filterfp=False) | test_scaneventresults_should_return_a_list | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_scaneventresultsunique_should_return_a_list(self):
"""
Test scaneventresultsunique(self, id, eventType, filterfp=False)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
scan_results = sfwebui.scaneventresultsunique(None, None, None)
self.assertIsInstance(scan_results, list)
scan_results = sfwebui.scaneventresultsunique('', '', '')
self.assertIsInstance(scan_results, list) | Test scaneventresultsunique(self, id, eventType, filterfp=False) | test_scaneventresultsunique_should_return_a_list | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_search_should_return_a_list(self):
"""
Test search(self, id=None, eventType=None, value=None)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
search_results = sfwebui.search(None, None, None)
self.assertIsInstance(search_results, list)
search_results = sfwebui.search('', '', '')
self.assertIsInstance(search_results, list) | Test search(self, id=None, eventType=None, value=None) | test_search_should_return_a_list | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_scan_history_missing_scanid_should_return_error(self):
"""
Test scanhistory(self, id)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
scan_history = sfwebui.scanhistory(None)
self.assertIsInstance(scan_history, dict)
self.assertEqual("No scan specified", scan_history.get('error').get('message'))
scan_history = sfwebui.scanhistory("example scan id")
self.assertIsInstance(scan_history, list) | Test scanhistory(self, id) | test_scan_history_missing_scanid_should_return_error | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_scan_history_should_return_a_list(self):
"""
Test scanhistory(self, id)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
scan_history = sfwebui.scanhistory("example scan id")
self.assertIsInstance(scan_history, list) | Test scanhistory(self, id) | test_scan_history_should_return_a_list | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_scan_element_type_discovery_should_return_a_dict(self):
"""
Test scanelementtypediscovery(self, id, eventType)
"""
opts = self.default_options
opts['__modules__'] = dict()
sfwebui = SpiderFootWebUi(self.web_default_options, opts)
scan_element_type_discovery = sfwebui.scanelementtypediscovery(None, None)
self.assertIsInstance(scan_element_type_discovery, dict)
scan_element_type_discovery = sfwebui.scanelementtypediscovery('', '')
self.assertIsInstance(scan_element_type_discovery, dict) | Test scanelementtypediscovery(self, id, eventType) | test_scan_element_type_discovery_should_return_a_dict | python | smicallef/spiderfoot | test/unit/test_spiderfootwebui.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootwebui.py | MIT |
def test_init_argument_start_false_should_create_a_scan_without_starting_the_scan(self):
"""
Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts, start=True)
"""
opts = self.default_options
opts['__modules__'] = dict()
scan_id = str(uuid.uuid4())
module_list = ['sfp__stor_db']
sfscan = SpiderFootScanner("example scan name", scan_id, "spiderfoot.net", "INTERNET_NAME", module_list, opts, start=False)
self.assertIsInstance(sfscan, SpiderFootScanner)
self.assertEqual(sfscan.status, "INITIALIZING") | Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts, start=True) | test_init_argument_start_false_should_create_a_scan_without_starting_the_scan | python | smicallef/spiderfoot | test/unit/test_spiderfootscanner.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootscanner.py | MIT |
def test_init_argument_scanName_of_invalid_type_should_raise_TypeError(self):
"""
Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts, start=True)
"""
scan_id = str(uuid.uuid4())
module_list = ['sfp__stor_db']
invalid_types = [None, list(), dict(), int()]
for invalid_type in invalid_types:
with self.subTest(invalid_type=invalid_type):
with self.assertRaises(TypeError):
SpiderFootScanner(invalid_type, scan_id, "spiderfoot.net", "IP_ADDRESS", module_list, self.default_options, start=False) | Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts, start=True) | test_init_argument_scanName_of_invalid_type_should_raise_TypeError | python | smicallef/spiderfoot | test/unit/test_spiderfootscanner.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootscanner.py | MIT |
def test_init_argument_scanName_as_empty_string_should_raise_ValueError(self):
"""
Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts, start=True)
"""
scan_id = str(uuid.uuid4())
module_list = ['sfp__stor_db']
with self.assertRaises(ValueError):
SpiderFootScanner("", scan_id, "spiderfoot.net", "IP_ADDRESS", module_list, self.default_options, start=False) | Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts, start=True) | test_init_argument_scanName_as_empty_string_should_raise_ValueError | python | smicallef/spiderfoot | test/unit/test_spiderfootscanner.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootscanner.py | MIT |
def test_init_argument_scanId_of_invalid_type_should_raise_TypeError(self):
"""
Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts, start=True)
"""
module_list = ['sfp__stor_db']
invalid_types = [None, list(), dict(), int()]
for invalid_type in invalid_types:
with self.subTest(invalid_type=invalid_type):
with self.assertRaises(TypeError):
SpiderFootScanner("example scan name", invalid_type, "spiderfoot.net", "IP_ADDRESS", module_list, self.default_options, start=False) | Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts, start=True) | test_init_argument_scanId_of_invalid_type_should_raise_TypeError | python | smicallef/spiderfoot | test/unit/test_spiderfootscanner.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootscanner.py | MIT |
def test_init_argument_scanId_as_empty_string_should_raise_ValueError(self):
"""
Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts, start=True)
"""
scan_id = ""
module_list = ['sfp__stor_db']
with self.assertRaises(ValueError):
SpiderFootScanner("example scan name", scan_id, "spiderfoot.net", "IP_ADDRESS", module_list, self.default_options, start=False) | Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts, start=True) | test_init_argument_scanId_as_empty_string_should_raise_ValueError | python | smicallef/spiderfoot | test/unit/test_spiderfootscanner.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootscanner.py | MIT |
def test_init_argument_targetValue_of_invalid_type_should_raise_TypeError(self):
"""
Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts, start=True)
"""
scan_id = str(uuid.uuid4())
module_list = ['sfp__stor_db']
invalid_types = [None, list(), dict(), int()]
for invalid_type in invalid_types:
with self.subTest(invalid_type=invalid_type):
with self.assertRaises(TypeError):
SpiderFootScanner("example scan name", scan_id, invalid_type, "IP_ADDRESS", module_list, self.default_options, start=False) | Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts, start=True) | test_init_argument_targetValue_of_invalid_type_should_raise_TypeError | python | smicallef/spiderfoot | test/unit/test_spiderfootscanner.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootscanner.py | MIT |
def test_init_argument_targetValue_as_empty_string_should_raise_ValueError(self):
"""
Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts, start=True)
"""
scan_id = str(uuid.uuid4())
module_list = ['sfp__stor_db']
with self.assertRaises(ValueError):
SpiderFootScanner("example scan name", scan_id, "", "IP_ADDRESS", module_list, self.default_options, start=False) | Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts, start=True) | test_init_argument_targetValue_as_empty_string_should_raise_ValueError | python | smicallef/spiderfoot | test/unit/test_spiderfootscanner.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootscanner.py | MIT |
def test_init_argument_targetType_of_invalid_type_should_raise_TypeError(self):
"""
Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts)
"""
scan_id = str(uuid.uuid4())
module_list = ['sfp__stor_db']
invalid_types = [None, list(), dict(), int()]
for invalid_type in invalid_types:
with self.subTest(invalid_type=invalid_type):
with self.assertRaises(TypeError):
SpiderFootScanner("example scan name", scan_id, "spiderfoot.net", invalid_type, module_list, self.default_options, start=False) | Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts) | test_init_argument_targetType_of_invalid_type_should_raise_TypeError | python | smicallef/spiderfoot | test/unit/test_spiderfootscanner.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootscanner.py | MIT |
def test_init_argument_targetType_invalid_value_should_raise_ValueError(self):
"""
Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts)
"""
scan_id = str(uuid.uuid4())
module_list = ['sfp__stor_db']
target_type = ""
with self.assertRaises(ValueError):
SpiderFootScanner("example scan name", scan_id, "spiderfoot.net", target_type, module_list, self.default_options, start=False)
target_type = "INVALID_TARGET_TYPE"
with self.assertRaises(ValueError):
SpiderFootScanner("example scan name", scan_id, "spiderfoot.net", target_type, module_list, self.default_options, start=False) | Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts) | test_init_argument_targetType_invalid_value_should_raise_ValueError | python | smicallef/spiderfoot | test/unit/test_spiderfootscanner.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootscanner.py | MIT |
def test_init_argument_moduleList_of_invalid_type_should_raise_TypeError(self):
"""
Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts)
"""
scan_id = str(uuid.uuid4())
invalid_types = [None, "", dict(), int()]
for invalid_type in invalid_types:
with self.subTest(invalid_type=invalid_type):
with self.assertRaises(TypeError):
SpiderFootScanner("example scan name", scan_id, "spiderfoot.net", "IP_ADDRESS", invalid_type, self.default_options, start=False) | Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts) | test_init_argument_moduleList_of_invalid_type_should_raise_TypeError | python | smicallef/spiderfoot | test/unit/test_spiderfootscanner.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootscanner.py | MIT |
def test_init_argument_moduleList_as_empty_list_should_raise_ValueError(self):
"""
Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts)
"""
scan_id = str(uuid.uuid4())
module_list = list()
with self.assertRaises(ValueError):
SpiderFootScanner("example scan name", scan_id, "spiderfoot.net", "IP_ADDRESS", module_list, self.default_options, start=False) | Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts) | test_init_argument_moduleList_as_empty_list_should_raise_ValueError | python | smicallef/spiderfoot | test/unit/test_spiderfootscanner.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootscanner.py | MIT |
def test_init_argument_globalOpts_of_invalid_type_should_raise_TypeError(self):
"""
Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts)
"""
scan_id = str(uuid.uuid4())
module_list = ['sfp__stor_db']
invalid_types = [None, "", list(), int()]
for invalid_type in invalid_types:
with self.subTest(invalid_type=invalid_type):
with self.assertRaises(TypeError):
SpiderFootScanner("example scan name", scan_id, "spiderfoot.net", "IP_ADDRESS", module_list, invalid_type, start=False) | Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts) | test_init_argument_globalOpts_of_invalid_type_should_raise_TypeError | python | smicallef/spiderfoot | test/unit/test_spiderfootscanner.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootscanner.py | MIT |
def test_init_argument_globalOpts_as_empty_dict_should_raise_ValueError(self):
"""
Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts)
"""
scan_id = str(uuid.uuid4())
module_list = ['sfp__stor_db']
with self.assertRaises(ValueError):
SpiderFootScanner("example scan name", scan_id, "spiderfoot.net", "IP_ADDRESS", module_list, dict(), start=False) | Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts) | test_init_argument_globalOpts_as_empty_dict_should_raise_ValueError | python | smicallef/spiderfoot | test/unit/test_spiderfootscanner.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootscanner.py | MIT |
def test_init_argument_globalOpts_proxy_invalid_proxy_type_should_raise_ValueError(self):
"""
Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts)
"""
opts = self.default_options
opts['_socks1type'] = 'invalid proxy type'
opts['__modules__'] = dict()
scan_id = str(uuid.uuid4())
module_list = ['sfp__stor_db']
with self.assertRaises(ValueError):
SpiderFootScanner("example scan name", scan_id, "spiderfoot.net", "IP_ADDRESS", module_list, opts, start=False) | Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts) | test_init_argument_globalOpts_proxy_invalid_proxy_type_should_raise_ValueError | python | smicallef/spiderfoot | test/unit/test_spiderfootscanner.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootscanner.py | MIT |
def test_init_argument_globalOpts_proxy_type_without_host_should_raise_ValueError(self):
"""
Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts)
"""
opts = self.default_options
opts['_socks1type'] = 'HTTP'
opts['__modules__'] = dict()
scan_id = str(uuid.uuid4())
module_list = ['sfp__stor_db']
with self.assertRaises(ValueError):
SpiderFootScanner("example scan name", scan_id, "spiderfoot.net", "IP_ADDRESS", module_list, opts, start=False) | Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts) | test_init_argument_globalOpts_proxy_type_without_host_should_raise_ValueError | python | smicallef/spiderfoot | test/unit/test_spiderfootscanner.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootscanner.py | MIT |
def test_init_argument_globalOpts_proxy_should_set_proxy(self):
"""
Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts)
"""
opts = self.default_options
opts['_socks1type'] = 'HTTP'
opts['_socks2addr'] = '127.0.0.1'
opts['_socks3port'] = '8080'
opts['_socks4user'] = 'user'
opts['_socks5pwd'] = 'password'
opts['__modules__'] = dict()
scan_id = str(uuid.uuid4())
module_list = ['sfp__stor_db']
SpiderFootScanner("example scan name", scan_id, "spiderfoot.net", "IP_ADDRESS", module_list, opts, start=False)
self.assertEqual('TBD', 'TBD') | Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts) | test_init_argument_globalOpts_proxy_should_set_proxy | python | smicallef/spiderfoot | test/unit/test_spiderfootscanner.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootscanner.py | MIT |
def test_init_argument_globalOpts_proxy_without_port_should_set_proxy(self):
"""
Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts)
"""
opts = self.default_options
opts['_socks1type'] = 'HTTP'
opts['_socks2addr'] = '127.0.0.1'
opts['_socks3port'] = ''
opts['__modules__'] = dict()
scan_id = str(uuid.uuid4())
module_list = ['sfp__stor_db']
SpiderFootScanner("example scan name", scan_id, "spiderfoot.net", "IP_ADDRESS", module_list, opts, start=False)
self.assertEqual('TBD', 'TBD') | Test __init__(self, scanName, scanId, scanTarget, targetType, moduleList, globalOpts) | test_init_argument_globalOpts_proxy_without_port_should_set_proxy | python | smicallef/spiderfoot | test/unit/test_spiderfootscanner.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootscanner.py | MIT |
def test__setStatus_argument_status_of_invalid_type_should_raise_TypeError(self):
"""
Test __setStatus(self, status, started=None, ended=None)
"""
opts = self.default_options
opts['__modules__'] = dict()
scan_id = str(uuid.uuid4())
module_list = ['sfp__stor_db']
sfscan = SpiderFootScanner("example scan name", scan_id, "spiderfoot.net", "IP_ADDRESS", module_list, opts, start=False)
invalid_types = [None, list(), dict(), int()]
for invalid_type in invalid_types:
with self.subTest(invalid_type=invalid_type):
with self.assertRaises(TypeError):
sfscan._SpiderFootScanner__setStatus(invalid_type) | Test __setStatus(self, status, started=None, ended=None) | test__setStatus_argument_status_of_invalid_type_should_raise_TypeError | python | smicallef/spiderfoot | test/unit/test_spiderfootscanner.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootscanner.py | MIT |
def test__setStatus_argument_status_with_blank_value_should_raise_ValueError(self):
"""
Test __setStatus(self, status, started=None, ended=None)
"""
opts = self.default_options
opts['__modules__'] = dict()
scan_id = str(uuid.uuid4())
module_list = ['sfp__stor_db']
sfscan = SpiderFootScanner("example scan name", scan_id, "spiderfoot.net", "IP_ADDRESS", module_list, opts, start=False)
with self.assertRaises(ValueError):
sfscan._SpiderFootScanner__setStatus("example invalid scan status") | Test __setStatus(self, status, started=None, ended=None) | test__setStatus_argument_status_with_blank_value_should_raise_ValueError | python | smicallef/spiderfoot | test/unit/test_spiderfootscanner.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/test_spiderfootscanner.py | MIT |
def test_init(self):
"""
Test __init__(self)
"""
sfp = SpiderFootPlugin()
self.assertIsInstance(sfp, SpiderFootPlugin) | Test __init__(self) | test_init | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_updateSocket(self):
"""
Test _updateSocket(self, sock)
"""
sfp = SpiderFootPlugin()
sfp._updateSocket(None)
self.assertEqual('TBD', 'TBD') | Test _updateSocket(self, sock) | test_updateSocket | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_clearListeners(self):
"""
Test clearListeners(self)
"""
sfp = SpiderFootPlugin()
sfp.clearListeners()
self.assertEqual('TBD', 'TBD') | Test clearListeners(self) | test_clearListeners | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_setup(self):
"""
Test setup(self, sf, userOpts=dict())
"""
sfp = SpiderFootPlugin()
sfp.setup(None)
sfp.setup(None, None)
self.assertEqual('TBD', 'TBD') | Test setup(self, sf, userOpts=dict()) | test_setup | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_enrichTargetargument_target_should_enrih_target(self):
"""
Test enrichTarget(self, target)
"""
sfp = SpiderFootPlugin()
sfp.enrichTarget(None)
self.assertEqual('TBD', 'TBD') | Test enrichTarget(self, target) | test_enrichTargetargument_target_should_enrih_target | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_setTarget_should_set_a_target(self):
"""
Test setTarget(self, target)
"""
sfp = SpiderFootPlugin()
target = SpiderFootTarget("spiderfoot.net", "INTERNET_NAME")
sfp.setTarget(target)
get_target = sfp.getTarget().targetValue
self.assertIsInstance(get_target, str)
self.assertEqual("spiderfoot.net", get_target) | Test setTarget(self, target) | test_setTarget_should_set_a_target | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_setTarget_argument_target_invalid_type_should_raise_TypeError(self):
"""
Test setTarget(self, target)
"""
sfp = SpiderFootPlugin()
invalid_types = [None, "", list(), dict(), int()]
for invalid_type in invalid_types:
with self.subTest(invalid_type=invalid_type):
with self.assertRaises(TypeError):
sfp.setTarget(invalid_type) | Test setTarget(self, target) | test_setTarget_argument_target_invalid_type_should_raise_TypeError | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_set_dbhargument_dbh_should_set_database_handle(self):
"""
Test setDbh(self, dbh)
"""
sfdb = SpiderFootDb(self.default_options, False)
sfp = SpiderFootPlugin()
sfp.setDbh(sfdb)
self.assertIsInstance(sfp.__sfdb__, SpiderFootDb) | Test setDbh(self, dbh) | test_set_dbhargument_dbh_should_set_database_handle | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_setScanId_argument_id_should_set_a_scan_id(self):
"""
Test setScanId(self, id)
"""
sfp = SpiderFootPlugin()
scan_id = '1234'
sfp.setScanId(scan_id)
get_scan_id = sfp.getScanId()
self.assertIsInstance(get_scan_id, str)
self.assertEqual(scan_id, get_scan_id) | Test setScanId(self, id) | test_setScanId_argument_id_should_set_a_scan_id | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_setScanId_argument_id_invalid_type_should_raise_TypeError(self):
"""
Test setScanId(self, id)
"""
sfp = SpiderFootPlugin()
invalid_types = [None, list(), dict(), int()]
for invalid_type in invalid_types:
with self.subTest(invalid_type=invalid_type):
with self.assertRaises(TypeError):
sfp.setScanId(invalid_type) | Test setScanId(self, id) | test_setScanId_argument_id_invalid_type_should_raise_TypeError | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_getScanId_should_return_a_string(self):
"""
Test getScanId(self)
"""
sfp = SpiderFootPlugin()
scan_id = 'example scan id'
sfp.setScanId(scan_id)
get_scan_id = sfp.getScanId()
self.assertIsInstance(get_scan_id, str)
self.assertEqual(scan_id, get_scan_id) | Test getScanId(self) | test_getScanId_should_return_a_string | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_getScanId_unitialised_scanid_should_raise_TypeError(self):
"""
Test getScanId(self)
"""
sfp = SpiderFootPlugin()
with self.assertRaises(TypeError):
sfp.getScanId() | Test getScanId(self) | test_getScanId_unitialised_scanid_should_raise_TypeError | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_getTarget_should_return_a_string(self):
"""
Test getTarget(self)
"""
sfp = SpiderFootPlugin()
target = SpiderFootTarget("spiderfoot.net", "INTERNET_NAME")
sfp.setTarget(target)
get_target = sfp.getTarget().targetValue
self.assertIsInstance(get_target, str)
self.assertEqual("spiderfoot.net", get_target) | Test getTarget(self) | test_getTarget_should_return_a_string | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_getTarget_unitialised_target_should_raise(self):
"""
Test getTarget(self)
"""
sfp = SpiderFootPlugin()
with self.assertRaises(TypeError):
sfp.getTarget() | Test getTarget(self) | test_getTarget_unitialised_target_should_raise | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_register_listener(self):
"""
Test registerListener(self, listener)
"""
sfp = SpiderFootPlugin()
sfp.registerListener(None)
self.assertEqual('TBD', 'TBD') | Test registerListener(self, listener) | test_register_listener | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_setOutputFilter_should_set_output_filter(self):
"""
Test setOutputFilter(self, types)
"""
sfp = SpiderFootPlugin()
output_filter = "test filter"
sfp.setOutputFilter("test filter")
self.assertEqual(output_filter, sfp.__outputFilter__) | Test setOutputFilter(self, types) | test_setOutputFilter_should_set_output_filter | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_tempStorage_should_return_a_dict(self):
"""
Test tempStorage(self)
"""
sfp = SpiderFootPlugin()
temp_storage = sfp.tempStorage()
self.assertIsInstance(temp_storage, dict) | Test tempStorage(self) | test_tempStorage_should_return_a_dict | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_notifyListeners_should_notify_listener_modules(self):
"""
Test notifyListeners(self, sfEvent)
"""
sfp = SpiderFootPlugin()
sfdb = SpiderFootDb(self.default_options, False)
sfp.setDbh(sfdb)
event_type = 'ROOT'
event_data = 'test data'
module = 'test module'
source_event = None
evt = SpiderFootEvent(event_type, event_data, module, source_event)
sfp.notifyListeners(evt)
self.assertEqual('TBD', 'TBD') | Test notifyListeners(self, sfEvent) | test_notifyListeners_should_notify_listener_modules | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_notifyListeners_output_filter_matched_should_notify_listener_modules(self):
"""
Test notifyListeners(self, sfEvent)
"""
sfp = SpiderFootPlugin()
sfdb = SpiderFootDb(self.default_options, False)
sfp.setDbh(sfdb)
target = SpiderFootTarget("spiderfoot.net", "INTERNET_NAME")
sfp.setTarget(target)
event_type = 'ROOT'
event_data = 'test data'
module = 'test module'
source_event = None
evt = SpiderFootEvent(event_type, event_data, module, source_event)
event_type = 'test event type'
event_data = 'test data'
module = 'test module'
source_event = evt
evt = SpiderFootEvent(event_type, event_data, module, source_event)
sfp.__outputFilter__ = event_type
sfp.notifyListeners(evt)
self.assertEqual('TBD', 'TBD') | Test notifyListeners(self, sfEvent) | test_notifyListeners_output_filter_matched_should_notify_listener_modules | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_notifyListeners_output_filter_unmatched_should_not_notify_listener_modules(self):
"""
Test notifyListeners(self, sfEvent)
"""
sfp = SpiderFootPlugin()
sfdb = SpiderFootDb(self.default_options, False)
sfp.setDbh(sfdb)
target = SpiderFootTarget("spiderfoot.net", "INTERNET_NAME")
sfp.setTarget(target)
event_type = 'ROOT'
event_data = 'test data'
module = 'test module'
source_event = None
evt = SpiderFootEvent(event_type, event_data, module, source_event)
event_type = 'test event type'
event_data = 'test data'
module = 'test module'
source_event = evt
evt = SpiderFootEvent(event_type, event_data, module, source_event)
sfp.__outputFilter__ = "example unmatched event type"
sfp.notifyListeners(evt)
self.assertEqual('TBD', 'TBD') | Test notifyListeners(self, sfEvent) | test_notifyListeners_output_filter_unmatched_should_not_notify_listener_modules | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_notifyListeners_event_type_and_data_same_as_source_event_source_event_should_story_only(self):
"""
Test notifyListeners(self, sfEvent)
"""
sfp = SpiderFootPlugin()
sfdb = SpiderFootDb(self.default_options, False)
sfp.setDbh(sfdb)
event_type = 'ROOT'
event_data = 'test data'
module = 'test module'
source_event = None
evt = SpiderFootEvent(event_type, event_data, module, source_event)
event_type = 'test event type'
event_data = 'test data'
module = 'test module'
source_event = evt
evt = SpiderFootEvent(event_type, event_data, module, source_event)
source_event = evt
evt = SpiderFootEvent(event_type, event_data, module, source_event)
source_event = evt
evt = SpiderFootEvent(event_type, event_data, module, source_event)
sfp.notifyListeners(evt)
self.assertEqual('TBD', 'TBD') | Test notifyListeners(self, sfEvent) | test_notifyListeners_event_type_and_data_same_as_source_event_source_event_should_story_only | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_notifyListeners_argument_sfEvent_invalid_event_should_raise_TypeError(self):
"""
Test notifyListeners(self, sfEvent)
"""
sfp = SpiderFootPlugin()
invalid_types = [None, "", list(), dict(), int()]
for invalid_type in invalid_types:
with self.subTest(invalid_type=invalid_type):
with self.assertRaises(TypeError):
sfp.notifyListeners(invalid_type) | Test notifyListeners(self, sfEvent) | test_notifyListeners_argument_sfEvent_invalid_event_should_raise_TypeError | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_checkForStop(self):
"""
Test checkForStop(self)
"""
sfp = SpiderFootPlugin()
class DatabaseStub:
def scanInstanceGet(self, scanId):
return [None, None, None, None, None, status]
sfp.__sfdb__ = DatabaseStub()
sfp.__scanId__ = 'example scan id'
# pseudo-parameterized test
scan_statuses = [
(None, False),
("anything", False),
("RUNNING", False),
("ABORT-REQUESTED", True)
]
for status, expectedReturnValue in scan_statuses:
returnValue = sfp.checkForStop()
self.assertEqual(returnValue, expectedReturnValue, status) | Test checkForStop(self) | test_checkForStop | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_watchedEvents_should_return_a_list(self):
"""
Test watchedEvents(self)
"""
sfp = SpiderFootPlugin()
watched_events = sfp.watchedEvents()
self.assertIsInstance(watched_events, list) | Test watchedEvents(self) | test_watchedEvents_should_return_a_list | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_producedEvents_should_return_a_list(self):
"""
Test producedEvents(self)
"""
sfp = SpiderFootPlugin()
produced_events = sfp.producedEvents()
self.assertIsInstance(produced_events, list) | Test producedEvents(self) | test_producedEvents_should_return_a_list | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
def test_handleEvent(self):
"""
Test handleEvent(self, sfEvent)
"""
event_type = 'ROOT'
event_data = 'example event data'
module = ''
source_event = ''
evt = SpiderFootEvent(event_type, event_data, module, source_event)
sfp = SpiderFootPlugin()
sfp.handleEvent(evt) | Test handleEvent(self, sfEvent) | test_handleEvent | python | smicallef/spiderfoot | test/unit/spiderfoot/test_spiderfootplugin.py | https://github.com/smicallef/spiderfoot/blob/master/test/unit/spiderfoot/test_spiderfootplugin.py | MIT |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.