From 4ca5c9f3ed6616dd383fc7762dbd65cf8c7c5c4a Mon Sep 17 00:00:00 2001 From: Fadl Date: Tue, 17 Dec 2024 17:15:17 +0100 Subject: [PATCH] add missing dependencies --- requirements_dev.txt | 3 ++- tests/st_hooks/bundle.py | 27 ++++++++++++++------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/requirements_dev.txt b/requirements_dev.txt index cc0b110..731c7d9 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1 +1,2 @@ -schemathesis \ No newline at end of file +schemathesis +https://github.com/muchdogesec/stix2arango/archive/main.zip?v=kz \ No newline at end of file diff --git a/tests/st_hooks/bundle.py b/tests/st_hooks/bundle.py index 1d112a8..5ecc230 100644 --- a/tests/st_hooks/bundle.py +++ b/tests/st_hooks/bundle.py @@ -91,22 +91,23 @@ def after_load_schema( schema: BaseOpenAPISchema,): logging.info("Running stix2arango") - from stix2arango.stix2arango import Stix2Arango - username = os.getenv('ARANGODB_USERNAME') - password = os.getenv('ARANGODB_PASSWORD') - try: - Stix2Arango(database=TEST_DB, collection=TEST_COLLECTION, file=None, host_url=os.getenv('ARANGODB_HOST_URL'), username=username, password=password) + username = os.getenv('ARANGODB_USERNAME', 'root') + password = os.getenv('ARANGODB_PASSWORD', '') + + @schema.auth() + class MyAuth: + def get(self, case, context): + return True - @schema.auth() - class MyAuth: - def get(self, case, context): - return True + def set(self, case, data, context): + case.headers = case.headers or {} - def set(self, case, data, context): - case.headers = case.headers or {} + token = b64encode(f"{username}:{password}".encode('utf-8')).decode("ascii") + case.headers["Authorization"] = f'Basic {token}' - token = b64encode(f"{username}:{password}".encode('utf-8')).decode("ascii") - case.headers["Authorization"] = f'Basic {token}' + try: + from stix2arango.stix2arango import Stix2Arango + Stix2Arango(database=TEST_DB, collection=TEST_COLLECTION, file=None, host_url=os.getenv('ARANGODB_HOST_URL'), username=username, password=password) except: logging.info("failed to auth") \ No newline at end of file