Commit 43ab1f1a authored by Johan Bloemberg's avatar Johan Bloemberg

test dummy scanner

parent 7b038ca5
......@@ -31,13 +31,15 @@ EXPIRES = 5
def scan(
organizations: dict = None,
urls: dict = None,
endpoints: dict = None
endpoints: dict = None,
execute=True
) -> Task:
"""Compose and execute taskset to scan specified organizations.
:param organizations: dict: limit organizations to scan to these filters, see below
:param urls: dict: limit urls to scan to these filters, see below
:param endpoints: dict: limit endpoints to scan to these filters, see below
:param execute: bool: don't return task but execute task and return result
Depending on the type of scanner (endpoint, domain level, etc) a list of scanable
items will be generated and a taskset will be composed to allow scanning of these items.
......@@ -62,7 +64,10 @@ def scan(
"""
task = compose(organizations_from_names(organizations))
return task
if execute:
return task.apply_async()
else:
return task
def compose(organizations: List[Organization]):
......
"""Integration tests of scanner commands."""
import json
import pytest
from django.core.management import call_command
TEST_ORGANIZATION = 'faalonië'
NON_EXISTING_ORGANIZATION = 'faaloniet'
def test_dummy(responses, db, faalonië):
"""Test running dummy scan."""
result = json.loads(call_command('scan-dummy-dumdum', '-v3', '-o', TEST_ORGANIZATION))
assert result[0]['status'] == 'success'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment