Skip to content

Commit

Permalink
Fix failing operation test
Browse files Browse the repository at this point in the history
(writing log to disk)
  • Loading branch information
clenk committed Apr 21, 2023
1 parent f32a96f commit 48ed801
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/objects/test_operation.py
Expand Up @@ -17,6 +17,7 @@
from app.objects.secondclass.c_result import Result
from app.objects.secondclass.c_fact import Fact
from app.utility.base_object import BaseObject
from app.utility.base_world import BaseWorld

LINK1_DECIDE_TIME = MOCK_LINK_FINISH_TIME = '2021-01-01T08:00:00Z'
LINK1_COLLECT_TIME = '2021-01-01T08:01:00Z'
Expand Down Expand Up @@ -74,6 +75,12 @@ def _encode_command(command_str):
return _encode_command


@pytest.fixture
def setup_op_config():
BaseWorld.apply_config(name='main', config={'exfil_dir': '/tmp/caldera',
'reports_dir': '/tmp'})


@pytest.fixture
def op_for_event_logs(operation_agent, operation_adversary, executor, ability, operation_link, encoded_command,
parse_datestring):
Expand Down Expand Up @@ -263,6 +270,9 @@ def test_event_logs(self, event_loop, op_for_event_logs, operation_agent, file_s
event_logs = event_loop.run_until_complete(op_for_event_logs.event_logs(file_svc, data_svc))
assert event_logs == want

@pytest.mark.usefixtures(
"setup_op_config"
)
def test_writing_event_logs_to_disk(self, event_loop, op_for_event_logs, operation_agent, file_svc, data_svc,
event_log_op_start_time, op_agent_creation_time, fire_event_mock):
event_loop.run_until_complete(data_svc.remove('agents', match=dict(unique=operation_agent.unique)))
Expand Down

0 comments on commit 48ed801

Please sign in to comment.