Convert class variables to instance variables.
jmeachum opened this issue · comments
jmeachum commented
When writing tests for the Attck class the class variables must be reset to None so that certain test which require them to be that way will pass. To reproduce the issue you can use the following test. If they are converted to instance vars the below test should fail.
@pytest.fixture
def attck():
yield Attck()
def test_class_vars_set(attck):
assert attck._Attck__ENTERPRISE_ATTCK_JSON is None
assert attck._Attck__ENTERPRISE_GENERATED_DATA_JSON is None
assert attck._Attck__ENTERPRISE_NIST_DATA_JSON is None
techniques = attck.enterprise.techniques
assert isinstance(techniques, list)
assert isinstance(attck._Attck__ENTERPRISE_ATTCK_JSON, dict)
assert isinstance(attck._Attck__ENTERPRISE_GENERATED_DATA_JSON, dict)
assert isinstance(attck._Attck__ENTERPRISE_NIST_DATA_JSON, dict)
def test_class_vars_persist_tests(attck):
assert isinstance(attck._Attck__ENTERPRISE_ATTCK_JSON, dict)
assert isinstance(attck._Attck__ENTERPRISE_GENERATED_DATA_JSON, dict)
assert isinstance(attck._Attck__ENTERPRISE_NIST_DATA_JSON, dict)
Josh Rickard commented
@jmeachum Please checkout the new release which resolves this issue and adds much better handling of configuration going forward.
pip install pyattck==4.0.0