muchdogesec / arango_cti_processor

A small script that creates relationships between common CTI knowledge-bases in STIX 2.1 format.
https://www.dogesec.com/
GNU Affero General Public License v3.0
3 stars 0 forks source link

Odd behaviour now occurring in tests #26

Open himynamesdave opened 1 week ago

himynamesdave commented 1 week ago

The imported objects seems to be created 4 times. See expected result, and then the actual result (which is always exactly 4 times larger)

python3 -m unittest tests/test_1_0_capec_to_attack.py
======================================================================
FAIL: test_02_arango_cti_processor_note (tests.test_1_0_capec_to_attack.TestArangoDB)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dgreenwood/Documents/repos/dogesec/arango_cti_processor/tests/test_1_0_capec_to_attack.py", line 80, in test_02_arango_cti_processor_note
    self.assertEqual(result_count, [346], f"Expected 346 documents, but found {result_count}.")
AssertionError: Lists differ: [1384] != [346]

First differing element 0:
1384
346

- [1384]
+ [346] : Expected 346 documents, but found [1384].

----------------------------------------------------------------------
Ran 11 tests in 59.146s
python3 -m unittest tests/test_2_0_capec_to_cwe.py
======================================================================
FAIL: test_02_arango_cti_processor_note (tests.test_2_0_capec_to_cwe.TestArangoDB)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dgreenwood/Documents/repos/dogesec/arango_cti_processor/tests/test_2_0_capec_to_cwe.py", line 73, in test_02_arango_cti_processor_note
    self.assertEqual(result_count, [1212], f"Expected 1212 documents, but found {result_count}.")
AssertionError: Lists differ: [4848] != [1212]

First differing element 0:
4848
1212

- [4848]
+ [1212] : Expected 1212 documents, but found [4848].
fqrious commented 1 week ago

not a bug, filtering doc._is_ref == false in the test fixes this

himynamesdave commented 1 week ago

But why are there old objects? The script has only run once at this point, and deletes any historic versions of objects first

fqrious commented 6 days ago

There are no old or odd objects, the filter you were using is wrong