コード例 #1
0
 def test_handoff_error(self):
     env = self.mox.CreateMockAnything()
     queue = self.mox.CreateMockAnything()
     queue.enqueue(env).AndRaise(RuntimeError)
     self.mox.ReplayAll()
     edge = Edge(queue)
     with self.assertRaises(RuntimeError):
         edge.handoff(env)
コード例 #2
0
 def test_handoff_error(self):
     env = self.mox.CreateMockAnything()
     queue = self.mox.CreateMockAnything()
     queue.enqueue(env).AndRaise(RuntimeError)
     self.mox.ReplayAll()
     edge = Edge(queue)
     with self.assertRaises(RuntimeError):
         edge.handoff(env)
コード例 #3
0
 def test_handoff(self):
     self.mox.StubOutWithMock(time, 'time')
     env = self.mox.CreateMockAnything()
     queue = self.mox.CreateMockAnything()
     time.time().AndReturn(12345)
     queue.enqueue(env).AndReturn('asdf')
     self.mox.ReplayAll()
     edge = Edge(queue, 'test.example.com')
     self.assertEqual('asdf', edge.handoff(env))
     self.assertEqual('test.example.com', env.receiver)
     self.assertEqual(12345, env.timestamp)
コード例 #4
0
 def test_handoff(self):
     self.mox.StubOutWithMock(time, 'time')
     env = self.mox.CreateMockAnything()
     queue = self.mox.CreateMockAnything()
     time.time().AndReturn(12345)
     queue.enqueue(env).AndReturn('asdf')
     self.mox.ReplayAll()
     edge = Edge(queue, 'test.example.com')
     self.assertEqual('asdf', edge.handoff(env))
     self.assertEqual('test.example.com', env.receiver)
     self.assertEqual(12345, env.timestamp)