Example #1
0
 def testScenarioFromSrpy(self):
     # test that compilation and resurrection give the same scenario
     self.scenario = get_test_scenario_from_file('stest.py')
     compile_scenario('stest.py')
     self.assertTrue(os.stat('stest.srpy') != None)
     self.scenario_compiled = get_test_scenario_from_file('stest.srpy')
     self.assertIsInstance(self.scenario_compiled, Scenario)
     self.assertEqual(self.scenario, self.scenario_compiled)
Example #2
0
 def testScenarioFromSrpy(self):
     # test that compilation and resurrection give the same scenario
     self.scenario = get_test_scenario_from_file('stest.py')
     compile_scenario('stest.py')
     self.assertTrue(os.stat('stest.srpy') != None)
     self.scenario_compiled = get_test_scenario_from_file('stest.srpy')
     self.assertIsInstance(self.scenario_compiled, TestScenario)
     self.assertEqual(self.scenario, self.scenario_compiled)
Example #3
0
 def testInterfaces(self):
     self.scenario = get_test_scenario_from_file('stest.py')
     p = self.scenario.ports()
     self.assertIn('router-eth0', p)
     self.assertIn('router-eth1', p)
     self.assertIn('router-eth2', p)
     self.assertIn('router-eth3', p)
Example #4
0
 def testNoMorePending(self):
     self.scenario = get_test_scenario_from_file('stest.py')
     s = copy.deepcopy(self.scenario)
     s.pending_events.pop()
     s.next()
     s.testpass()
     self.assertRaises(ScenarioFailure, s.next)
Example #5
0
 def testInterfaces(self):
     self.scenario = get_test_scenario_from_file('stest.py')
     p = self.scenario.ports()
     self.assertIn('router-eth0', p)
     self.assertIn('router-eth1', p)
     self.assertIn('router-eth2', p)
     self.assertIn('router-eth3', p)
Example #6
0
 def testNoMorePending(self):
     self.scenario = get_test_scenario_from_file('stest.py')
     s = copy.deepcopy(self.scenario)
     s._pending_events.pop()
     s.next()
     s.testpass()
     self.assertRaises(TestScenarioFailure, s.next)
Example #7
0
 def testScenarioFromPy(self):
     self.scenario = get_test_scenario_from_file('stest.py')
     self.assertIsInstance(self.scenario, Scenario)
     self.assertIsInstance(self.scenario.next(), PacketInputEvent)
     self.scenario.testpass()
     self.assertIsInstance(self.scenario.next(), PacketOutputEvent)
     self.scenario.testpass()
     self.assertRaises(ScenarioFailure, self.scenario.next)
Example #8
0
 def testScenarioFromPy(self):
     self.scenario = get_test_scenario_from_file('stest.py')
     self.assertIsInstance(self.scenario, TestScenario)
     self.assertIsInstance(self.scenario.next(), PacketInputEvent)
     self.scenario.testpass()
     self.assertIsInstance(self.scenario.next(), PacketOutputEvent)
     self.scenario.testpass()
     self.assertRaises(TestScenarioFailure, self.scenario.next)
Example #9
0
 def testScenarioSanity(self):
     self.scenario = get_test_scenario_from_file('stest.py')
     self.scenario.scenario_sanity_check()
Example #10
0
 def testSlowOutput(self):
     self.scenario = get_test_scenario_from_file('stest.py')
     self.scenario.next()
     self.scenario.testpass()
     self.scenario.next()
     self.assertRaises(ScenarioFailure, time.sleep, 61)
Example #11
0
 def testScenarioSanity(self):
     self.scenario = get_test_scenario_from_file('stest.py')
     self.scenario.scenario_sanity_check()
Example #12
0
 def testSlowOutput(self):
     self.scenario = get_test_scenario_from_file('stest.py')
     self.scenario.next()
     self.scenario.testpass()
     self.scenario.next()
     self.assertRaises(TestScenarioFailure, time.sleep, 61)
Example #13
0
 def testCleanScenario(self):
     scen = get_test_scenario_from_file('stest')
     self.assertFalse(scen.done())
     self.assertEqual(len(scen.pending_events), 4)
     self.assertListEqual(scen.completed_events, [])
Example #14
0
 def testCleanScenario(self):
     scen = get_test_scenario_from_file('stest')
     self.assertFalse(scen.done())
     self.assertEqual(len(scen.pending_events), 4)
     self.assertListEqual(scen.completed_events, [])