class TestHitProcessorChainLink(unittest.TestCase):
    def setUp(self):
        self.h1 = HitProcessorChainLink()
        self.h2 = HitProcessorChainLink()

    def test_default_constructor(self):
        self.assertTrue(self.h1.next_link is None)

    def test_constructor(self):
        h = HitProcessorChainLink(self.h1)
        self.assertEqual(self.h1, h.next_link)

    def test_set_next(self):
        self.assertTrue(self.h1.next_link is None)
        retval = self.h1.set_next(self.h2)
        self.assertEqual(self.h2, retval)
        self.assertEqual(self.h2, self.h1.next_link)

    def test_process_no_next(self):
        self.h1.process("test") # shouldn't raise

    def test_process_next(self):
        class Receiver(object):
            def process(self, pair):
                self.received = pair

        receiver = Receiver()
        self.h1.set_next(receiver)
        self.h1.process("test")
        self.assertEqual(receiver.received, "test")
class TestHitProcessorChainLink(unittest.TestCase):
	def setUp(self):
		self.h1 = HitProcessorChainLink()
		self.h2 = HitProcessorChainLink()

	def test_default_constructor(self):
		self.assertTrue(self.h1.next_link is None)

	def test_constructor(self):
		h = HitProcessorChainLink(self.h1)
		self.assertEqual(self.h1, h.next_link)

	def test_set_next(self):
		self.assertTrue(self.h1.next_link is None)
		retval = self.h1.set_next(self.h2)
		self.assertEqual(self.h2, retval)
		self.assertEqual(self.h2, self.h1.next_link)

	def test_process_no_next(self):
		self.h1.process("test") # shouldn't raise

	def test_process_next(self):
		class Receiver(object):
			def process(self, pair):
				self.received = pair

		receiver = Receiver()
		self.h1.set_next(receiver)
		self.h1.process("test")
		self.assertEqual(receiver.received, "test")
예제 #3
0
	def test_constructor_link(self):
		h = EmitSamLink(self.map_ctx, self.monitor)
		self.assertTrue(h.next_link is None)
		other = HitProcessorChainLink()
		h = EmitSamLink(self.map_ctx, self.monitor, other)
		self.assertEqual(other, h.next_link)
 def test_constructor(self):
     h = HitProcessorChainLink(self.h1)
     self.assertEqual(self.h1, h.next_link)
 def setUp(self):
     self.h1 = HitProcessorChainLink()
     self.h2 = HitProcessorChainLink()
	def setUp(self):
		self.h1 = HitProcessorChainLink()
		self.h2 = HitProcessorChainLink()