Newer
Older
Brian O'Connor
committed
#!/usr/bin/env python
"""
Test for scratchnet.py
"""
Brian O'Connor
committed
import unittest
import pexpect
class testScratchNet( unittest.TestCase ):
opts = [ "1 packets transmitted, 1 received, 0% packet loss", pexpect.EOF ]
Brian O'Connor
committed
def pingTest( self, name ):
"Verify that no ping packets were dropped"
Brian O'Connor
committed
p = pexpect.spawn( 'python -m %s' % name )
index = p.expect( self.opts )
Brian O'Connor
committed
self.assertEqual( index, 0 )
def testPingKernel( self ):
self.pingTest( 'mininet.examples.scratchnet' )
def testPingUser( self ):
self.pingTest( 'mininet.examples.scratchnetuser' )
if __name__ == '__main__':
unittest.main()