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)
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)
def test_kill(self): queue = self.mox.CreateMockAnything() self.mox.ReplayAll() edge = Edge(queue) edge.kill()