From d3846bea06026ed75df84f21343ade59583dfd63 Mon Sep 17 00:00:00 2001 From: cccs-rs <62077998+cccs-rs@users.noreply.github.com> Date: Fri, 9 Aug 2024 17:43:03 +0000 Subject: [PATCH] Update tests --- test/test_ingest.py | 7 ++++--- test/test_submit.py | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/test/test_ingest.py b/test/test_ingest.py index f8118c91..9429930c 100644 --- a/test/test_ingest.py +++ b/test/test_ingest.py @@ -10,7 +10,7 @@ from assemblyline.common import forge from assemblyline.odm.messages.submission import Submission -from assemblyline.odm.models.config import HASH_PATTERN_MAP +from assemblyline.odm.models.config import HASH_PATTERN_MAP, DEFAULT_SUBMISSION_PROFILES from assemblyline.odm.models.file import File from assemblyline.odm.randomizer import random_model_obj, get_random_phrase from assemblyline.odm.random_data import create_users, wipe_users, create_services, wipe_services @@ -345,12 +345,13 @@ def test_ingest_submission_profile(datastore, login_session, scheduler): get_api_data(session, f"{host}/api/v4/ingest/", method="POST", data=json.dumps(data)) # Try using a submission profile with no parameters - data['submission_profile'] = "Static Analysis" + profile = DEFAULT_SUBMISSION_PROFILES[0] + data['submission_profile'] = profile["name"] get_api_data(session, f"{host}/api/v4/ingest/", method="POST", data=json.dumps(data)) # Try using a submission profile with a parameter you aren't allowed to set # The system should silently ignore your parameter and still create a submission - data['params'] = {'deep_scan': True} + data['params'] = {'services': ['blah']} get_api_data(session, f"{host}/api/v4/ingest/", method="POST", data=json.dumps(data)) # Restore original roles for later tests diff --git a/test/test_submit.py b/test/test_submit.py index 3818286a..4b0fba02 100644 --- a/test/test_submit.py +++ b/test/test_submit.py @@ -9,7 +9,7 @@ from conftest import get_api_data, APIError from assemblyline.common import forge -from assemblyline.odm.models.config import HASH_PATTERN_MAP +from assemblyline.odm.models.config import HASH_PATTERN_MAP, DEFAULT_SUBMISSION_PROFILES from assemblyline.odm.random_data import create_users, wipe_users, create_submission, wipe_submissions from assemblyline.odm.randomizer import get_random_phrase from assemblyline.remote.datatypes.queues.named import NamedQueue @@ -301,14 +301,15 @@ def test_submit_submission_profile(datastore, login_session, scheduler): get_api_data(session, f"{host}/api/v4/submit/", method="POST", data=json.dumps(data)) # Try using a submission profile with no parameters - data['submission_profile'] = "Static Analysis" + profile = DEFAULT_SUBMISSION_PROFILES[0] + data['submission_profile'] = profile["name"] get_api_data(session, f"{host}/api/v4/submit/", method="POST", data=json.dumps(data)) # Try using a submission profile with a parameter you aren't allowed to set # The system should silently ignore your parameter and still create a submission - data['params'] = {'deep_scan': True} + data['params'] = {'services': ['blah']} resp = get_api_data(session, f"{host}/api/v4/submit/", method="POST", data=json.dumps(data)) - assert resp['params']['deep_scan'] == False + assert resp['params']['services'] == profile['services'] # Restore original roles for later tests datastore.user.update('admin', [(datastore.user.UPDATE_REMOVE, 'type', 'user'),