33import os
44import sys
55import unittest
6+ import re
67
78from stormshield .sns .sslclient import SSLClient
89
@@ -25,29 +26,14 @@ def tearDown(self):
2526 def test_raw (self ):
2627 """ raw format """
2728
28- expected = """101 code=00a01000 msg="Begin" format="raw"
29- AUTH : User authentication
30- CHPWD : Return if it's necessary to update password or not
31- CONFIG : Firewall configuration functions
32- GLOBALADMIN : Global administration
33- HA : HA functions
34- HELP : Display available commands
35- LIST : Display the list of connected users, show user rights (Level) and rights for current session (SessionLevel).
36- LOG : Log related functions.Everywhere a timezone is needed, if not specified the command is treated with firewall timezone setting.
37- MODIFY : Get / lose the modify or the mon_write right
38- MONITOR : Monitor related functions
39- NOP : Do nothing but avoid disconnection from server.
40- PKI : show or update the pki
41- QUIT : Log off
42- REPORT : Handling of reports
43- SYSTEM : System commands
44- USER : User related functions
45- VERSION : Display server version
29+ expected_re = """101 code=00a01000 msg="Begin" format="raw"
30+ AUTH.*
31+ CHPWD.*
4632100 code=00a00100 msg="Ok\" """
4733
4834 response = self .client .send_command ('HELP' )
4935
50- self .assertEqual ( response .output , expected )
36+ self .assertTrue ( re . match ( expected_re , response .output , re . MULTILINE | re . DOTALL ) )
5137 self .assertEqual (response .ret , 100 )
5238
5339 def test_section (self ):
@@ -115,7 +101,7 @@ def test_xml(self):
115101
116102 expected = """101 code=00a01000 msg="Begin" format="xml"
117103<data format="xml"><filters total_lines="5">
118- <separator collapse="0" color="c0c0c0" comment="Remote Management: Go to System -> Configuration to setup the web administration application access" first_ruleid="1" nb_elements="2" position="1" />
104+ <separator collapse="0" color="c0c0c0" comment="Remote Management: Go to System - Configuration to setup the web administration application access" first_ruleid="1" nb_elements="2" position="1" />
119105<filter action="pass" comment="Admin from everywhere" index="1" position="2" status="active" type="local_filter_slot"><noconnlog disk="0" ipfix="0" syslog="0" /><from><target type="any" value="any" /></from><to><port type="single" value="firewall_srv" /><port type="single" value="https" /><target type="group" value="firewall_all" /></to></filter>
120106<filter action="pass" comment="Allow Ping from everywhere" icmp_code="0" icmp_type="8" index="2" ipproto="icmp" position="3" proto="none" status="active" type="local_filter_slot"><noconnlog disk="0" ipfix="0" syslog="0" /><from><target type="any" value="any" /></from><to><target type="group" value="firewall_all" /></to></filter>
121107<separator collapse="0" color="c0c0c0" comment="Default policy" first_ruleid="3" nb_elements="1" position="4" />
0 commit comments