From 05102628a7dc85a5a19a32415a7ec41ea7a91812 Mon Sep 17 00:00:00 2001 From: Max Nanis Date: Fri, 21 Aug 2026 01:38:27 -0700 Subject: moving create_dummy, organizing test_utils, working on django config for any repos --- tests/grliq/managers/test_forensic_data.py | 35 +++++++++++++++------------ tests/grliq/managers/test_forensic_results.py | 4 ++- 2 files changed, 22 insertions(+), 17 deletions(-) (limited to 'tests/grliq') diff --git a/tests/grliq/managers/test_forensic_data.py b/tests/grliq/managers/test_forensic_data.py index ac2792a..e4854e8 100644 --- a/tests/grliq/managers/test_forensic_data.py +++ b/tests/grliq/managers/test_forensic_data.py @@ -1,20 +1,23 @@ +from __future__ import annotations + from datetime import timedelta from typing import TYPE_CHECKING from uuid import uuid4 import pytest +from generalresearch.grliq.models.events import MouseEvent, TimingData +from generalresearch.grliq.models.forensic_data import GrlIqData +from generalresearch.grliq.models.forensic_result import ( + GrlIqCheckerResults, + GrlIqForensicCategoryResult, +) + if TYPE_CHECKING: from generalresearch.grliq.managers.forensic_data import ( GrlIqDataManager, GrlIqEventManager, ) - from generalresearch.grliq.models.events import MouseEvent, TimingData - from generalresearch.grliq.models.forensic_data import GrlIqData - from generalresearch.grliq.models.forensic_result import ( - GrlIqCheckerResults, - GrlIqForensicCategoryResult, - ) from generalresearch.models.thl.product import Product try: @@ -25,7 +28,7 @@ except ImportError: class TestGrlIqDataManager: - def test_create_dummy(self, grliq_dm: "GrlIqDataManager"): + def test_create_dummy(self, grliq_dm: GrlIqDataManager): from generalresearch.grliq.models.forensic_data import GrlIqData gd1: GrlIqData = grliq_dm.create_dummy(is_attempt_allowed=True) @@ -34,7 +37,7 @@ class TestGrlIqDataManager: assert isinstance(gd1.results, GrlIqCheckerResults) assert isinstance(gd1.category_result, GrlIqForensicCategoryResult) - def test_create(self, grliq_data: "GrlIqData", grliq_dm: "GrlIqDataManager"): + def test_create(self, grliq_data: GrlIqData, grliq_dm: GrlIqDataManager): grliq_dm.create(grliq_data) assert grliq_data.id is not None @@ -53,13 +56,13 @@ class TestGrlIqDataManager: def test_update_data(self): pass - def test_get_id(self, grliq_data: "GrlIqData", grliq_dm: "GrlIqDataManager"): + def test_get_id(self, grliq_data: GrlIqData, grliq_dm: GrlIqDataManager): grliq_dm.create(grliq_data) res = grliq_dm.get_data(forensic_id=grliq_data.id) assert res == grliq_data - def test_get_uuid(self, grliq_data: "GrlIqData", grliq_dm: "GrlIqDataManager"): + def test_get_uuid(self, grliq_data: GrlIqData, grliq_dm: GrlIqDataManager): grliq_dm.create(grliq_data) res = grliq_dm.get_data(forensic_uuid=grliq_data.uuid) @@ -73,7 +76,7 @@ class TestGrlIqDataManager: def test_get_unique_user_count_by_fingerprint(self): pass - def test_filter_data(self, grliq_data: "GrlIqData", grliq_dm: "GrlIqDataManager"): + def test_filter_data(self, grliq_data: GrlIqData, grliq_dm: GrlIqDataManager): grliq_dm.create(grliq_data) res = grliq_dm.filter_data(uuids=[grliq_data.uuid])[0] assert res == grliq_data @@ -100,7 +103,7 @@ class TestGrlIqDataManager: def test_make_filter_str(self): pass - def test_filter_count(self, grliq_dm: "GrlIqDataManager", product: "Product"): + def test_filter_count(self, grliq_dm: GrlIqDataManager, product: Product): res = grliq_dm.filter_count(product_id=product.uuid) assert isinstance(res, int) @@ -116,7 +119,7 @@ class TestGrlIqDataManager: class TestForensicDataGetAndFilter: - def test_events(self, grliq_dm: "GrlIqDataManager"): + def test_events(self, grliq_dm: GrlIqDataManager): """If load_events=True, the events and mouse_events attributes should be an array no matter what. An empty array means that the events were loaded, but there were no events available. @@ -141,7 +144,7 @@ class TestForensicDataGetAndFilter: assert len(instance.events) == 0 assert len(instance.mouse_events) == 0 - def test_timing(self, grliq_dm: "GrlIqDataManager", grliq_em: "GrlIqEventManager"): + def test_timing(self, grliq_dm: GrlIqDataManager, grliq_em: GrlIqEventManager): forensic_uuid = uuid4().hex grliq_dm.create_dummy(is_attempt_allowed=True, uuid=forensic_uuid) @@ -161,7 +164,7 @@ class TestForensicDataGetAndFilter: assert isinstance(instance.timing_data, TimingData) def test_events_events( - self, grliq_dm: "GrlIqDataManager", grliq_em: "GrlIqEventManager" + self, grliq_dm: GrlIqDataManager, grliq_em: GrlIqEventManager ): forensic_uuid = uuid4().hex grliq_dm.create_dummy(is_attempt_allowed=True, uuid=forensic_uuid) @@ -186,7 +189,7 @@ class TestForensicDataGetAndFilter: assert len(instance.keyboard_events) == 0 def test_events_click( - self, grliq_dm: "GrlIqDataManager", grliq_em: "GrlIqEventManager" + self, grliq_dm: GrlIqDataManager, grliq_em: GrlIqEventManager ): forensic_uuid = uuid4().hex grliq_dm.create_dummy(is_attempt_allowed=True, uuid=forensic_uuid) diff --git a/tests/grliq/managers/test_forensic_results.py b/tests/grliq/managers/test_forensic_results.py index 68db732..a030451 100644 --- a/tests/grliq/managers/test_forensic_results.py +++ b/tests/grliq/managers/test_forensic_results.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from typing import TYPE_CHECKING if TYPE_CHECKING: @@ -10,7 +12,7 @@ if TYPE_CHECKING: class TestGrlIqCategoryResultsReader: def test_filter_category_results( - self, grliq_dm: "GrlIqDataManager", grliq_crr: "GrlIqCategoryResultsReader" + self, grliq_dm: GrlIqDataManager, grliq_crr: GrlIqCategoryResultsReader ): from generalresearch.grliq.models.forensic_result import ( GrlIqForensicCategoryResult, -- cgit v1.2.3