~jdstrand/ufw/trunk

« back to all changes in this revision

Viewing changes to tests/unit/test_common.py

  • Committer: Jamie Strandboge
  • Date: 2017-10-09 00:57:59 UTC
  • mfrom: (965.2.6 ufw-nat)
  • Revision ID: jamie@ubuntu.com-20171009005759-y7nveidqufrruq3z
tests/unit/support.py: use 'nat-dst' and 'nat-src' instead of 'dst' and 'src'
src/parser.py: initial parsing of nat clause
src/common.py: initial support for nat clause
add some input verification of nat rules
adjust test_common.py for nat rules

Note: the tests are incomplete and the rules don't actually update the firewall

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
        '''Test _get_attrib()'''
105
105
        res = self.rules["any"]._get_attrib()
106
106
        search = "'-p all -j ACCEPT', action=allow, comment=, dapp=, " + \
107
 
                 "direction=in, dport=any, dst=0.0.0.0/0, forward=False, " + \
108
 
                 "interface_in=, interface_out=, logtype=, multi=False, " + \
109
 
                 "position=0, protocol=any, remove=False, sapp=, " + \
110
 
                 "sport=any, src=0.0.0.0/0, updated=False, v6=False"
 
107
                 "direction=in, dnat=, dnat_port=, dport=any, " + \
 
108
                 "dst=0.0.0.0/0, forward=False, interface_in=, " + \
 
109
                 "interface_out=, logtype=, multi=False, position=0, " + \
 
110
                 "protocol=any, remove=False, sapp=, snat=, " + \
 
111
                 "snat_port=, sport=any, src=0.0.0.0/0, " + \
 
112
                 "updated=False, v6=False"
111
113
        self.assertEquals(res, search, "'%s' != '%s'" % (res, search))
112
114
 
113
115
    def test_dup_rule(self):