Skip to content

Commit

Permalink
more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrej-lukas committed Nov 15, 2024
1 parent 9a04f79 commit 5179471
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,9 @@ def test_block_ip_same_host(self, env_obs_exploited_service):
new_state = env.step(state=state, action=action, agent_id=None)
assert target_host in new_state.known_blocks.keys()
assert blocked_host in new_state.known_blocks[target_host]

assert target_host in env._fw_blocks.keys()
assert blocked_host in env._fw_blocks[target_host]

def test_block_ip_same_different_source(self, env_obs_exploited_service):
env, state = env_obs_exploited_service
source_host = components.IP('192.168.2.2')
Expand All @@ -345,6 +347,9 @@ def test_block_ip_same_different_source(self, env_obs_exploited_service):
new_state = env.step(state=state, action=action, agent_id=None)
assert target_host in new_state.known_blocks.keys()
assert blocked_host in new_state.known_blocks[target_host]
assert target_host in env._fw_blocks.keys()
assert blocked_host in env._fw_blocks[target_host]


def test_block_ip_self_block(self, env_obs_exploited_service):
env, state = env_obs_exploited_service
Expand All @@ -355,4 +360,5 @@ def test_block_ip_self_block(self, env_obs_exploited_service):
"blocked_host": target_host}
action = components.Action(components.ActionType.BlockIP, parameters)
new_state = env.step(state=state, action=action, agent_id=None)
assert target_host not in new_state.known_blocks.keys()
assert target_host not in new_state.known_blocks.keys()
assert target_host not in env._fw_blocks.keys()

0 comments on commit 5179471

Please sign in to comment.