Пример #1
0
 def test_sendmsg_success_after_fail(self):
     returns = (InvalidDatapath("test"), None)
     self.dp.send_msg = MagicMock(side_effect=returns)
     self.mc.send_msg(self.dp, "foo", 2)  # test fails if this raises
Пример #2
0
 def test_sendmsg_fail(self):
     self.dp.send_msg = MagicMock(side_effect=InvalidDatapath("test"))
     with self.assertRaises(MagmaOFError):
         self.mc.send_msg(self.dp, "foo")