Module unittesting :: Class TestFwRecord
[hide private]
[frames] | no frames]

Class TestFwRecord

source code


A test for the class "FwRecord" from iptables.py

Nested Classes [hide private]

Inherited from unittest.TestCase: failureException

Instance Methods [hide private]
 
testInitGood(self)
Tests initializing based on records from different protocols as format of their records vary.
source code
 
testFilter(self)
Tests adding a new value to the filter, raising an exception when uknown key is referenced and returning N/A upon referencing known key with no value
source code
 
testItemGetValue(self)
Test correctness of values retreived
source code
 
testComparison(self)
Create two records from the same data, see of they are equal, then compare with a different one, see the exception
source code
 
stressTest(self)
A real world test with a big file
source code

Inherited from unittest.TestCase: __call__, __init__, __repr__, __str__, assertAlmostEqual, assertAlmostEquals, assertEqual, assertEquals, assertFalse, assertNotAlmostEqual, assertNotAlmostEquals, assertNotEqual, assertNotEquals, assertRaises, assertTrue, assert_, countTestCases, debug, defaultTestResult, fail, failIf, failIfAlmostEqual, failIfEqual, failUnless, failUnlessAlmostEqual, failUnlessEqual, failUnlessRaises, id, run, setUp, shortDescription, tearDown

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Class Variables [hide private]
  sample_tcp = 'Apr 2 21:01:25 jarilo kernel: [IPTABLES DROP] :...
  sample_icmp = 'Apr 2 21:15:40 jarilo kernel: [IPTABLES DROP] ...
  sample_udp = 'Apr 2 21:08:13 jarilo kernel: [IPTABLES DROP] :...
Properties [hide private]

Inherited from object: __class__

Class Variable Details [hide private]

sample_tcp

Value:
'''Apr  2 21:01:25 jarilo kernel: [IPTABLES DROP] : IN=eth0 OUT=
    MAC=00:11:43:2b:99:fe:00:19:aa:d6:24:bf:08:00 SRC=85.70.30.130 DST\
=10.34.32.27 
    LEN=349 TOS=0x0 0 PREC=0x00 TTL=114 ID=34270 DF PROTO=TCP SPT=3359\
7 DPT=60375 
    WINDOW=65470 RES=0x00 ACK PSH URGP=0 OPT (0101080A000415C625823E7F\
)'''

sample_icmp

Value:
'''Apr  2 21:15:40 jarilo kernel: [IPTABLES DROP] : IN= OUT=eth0 
    SRC=10.34.32.27 DST=209.85.129.147 LEN=84 TOS=0x00 PREC=0x00 TTL=6\
4 ID=0 DF 
    PROTO=ICMP TYPE=8 CODE=0 ID=36386 SEQ=1'''

sample_udp

Value:
'''Apr  2 21:08:13 jarilo kernel: [IPTABLES DROP] : IN=eth0 OUT= 
    MAC=ff:ff:ff:ff:ff:ff:00:e0:81:2f:58:19:08:00 SRC=10.34.32.101 DST\
=255.255.255.255 
    LEN=119 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=UDP SPT=631 DPT=63\
1 LEN=99

    '''