forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_autoscan.py
More file actions
32 lines (22 loc) · 892 Bytes
/
test_autoscan.py
File metadata and controls
32 lines (22 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import pytest
from arango import ArangoClient
from pretend import stub
from autoscan import *
arango_client = ArangoClient(hosts="http://testdb:8529")
def test_dispatch():
# Connect to arango system DB and create test DB
sys_db = arango_client.db("_system", username="", password="")
sys_db.create_database("test")
# Establish DB connection
db = arango_client.db("test", username="", password="")
db.create_collection("domains")
input_domains = [
{"domain": "cyber.gc.ca", "selectors": ["selector1", "selector2"]},
{"domain": "canada.ca"},
{"domain": "forces.gc.ca"},
]
for domain in input_domains:
db.collection("domains").insert(domain)
client_stub = stub(post=lambda url, json: None)
dispatched = scan("testdb", 8529, "test", "", "", http_client=client_stub)
assert dispatched == len(input_domains)