Пример #1
0
 def testHelp(self):
     #test stdout
     with patch('sys.stdout', new=StringIO()) as fake_out:
         with self.assertRaises(SystemExit):  #help function should exit
             nc = netcat.Netcat()
             nc.help()
             self.assertEqual(fake_out.getvalue().strip(),
                              nc.help.__doc__.strip())
Пример #2
0
 def testMainInput_help(self):
     #test stdin and stdout
     with patch('sys.stdout', new=StringIO()) as fake_out:
         with self.assertRaises(SystemExit):
             sys.argv = "./substitute_netcat -help".split()
             nc = netcat.Netcat()
             nc.main()
             self.assertEqual(fake_out.getvalue().strip(),
                              nc.help.__doc__.strip())
Пример #3
0
 def testMainInput_u(self):
     sys.argv = "./substitute_netcat -u test.txt".split()
     nc = netcat.Netcat()
     nc.main()
     self.assertEqual(nc.upload_destination, "test.txt")
Пример #4
0
 def testMainInput_c(self):
     sys.argv = "./substitute_netcat -c".split()
     nc = netcat.Netcat()
     nc.main()
     self.assertEqual(nc.command, True)
Пример #5
0
 def testMainInput_l(self):
     sys.argv = "./substitute_netcat -l".split()
     nc = netcat.Netcat()
     nc.main()
     self.assertEqual(nc.listen, True)