File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -450,6 +450,23 @@ def test_action_to_dict_quit_game(self):
450450 assert action_dict ["action_type" ] == str (action .type )
451451 assert len (action_dict ["parameters" ]) == 0
452452
453+ def test_action_to_dict_block_ip (self ):
454+ action = Action (
455+ action_type = ActionType .BlockIP ,
456+ parameters = {
457+ "target_host" : IP ("192.168.1.0" ),
458+ "source_host" : IP ("192.168.1.1" ),
459+ "blocked_ip" : IP ("1.1.1.1" )
460+ }
461+ )
462+ action_dict = action .as_dict
463+ new_action = Action .from_dict (action_dict )
464+ assert action == new_action
465+ assert action_dict ["action_type" ] == str (action .type )
466+ assert action_dict ["parameters" ]["target_host" ] == {'ip' : '192.168.1.0' }
467+ assert action_dict ["parameters" ]["source_host" ] == {'ip' : '192.168.1.1' }
468+ assert action_dict ["parameters" ]["blocked_ip" ] == {'ip' : '1.1.1.1' }
469+
453470 def test_action_type_eq_unsupported (self ):
454471 """Test ActionType equality with unsupported type"""
455472 assert (ActionType .FindData == 123 ) is False
You can’t perform that action at this time.
0 commit comments