def test_subscribe_receiver_invalid_data(self): setup = BoboSetup() sub = StubSubscriberSetup() setup.add_complex_event(event_def=BoboComplexEvent( name=NAME_NFA_A, pattern=stub_pattern_1, action=NoAction())) setup.config_receiver(StrDictValidator()) setup.subscribe_receiver(sub) setup.configure() receiver = setup.get_receiver() receiver.setup() receiver.add_data(VALUE_A) receiver.loop() self.assertEqual(VALUE_A, sub.invalid_data[0])
def test_subscribe_receiver_valid_data(self): setup = BoboSetup() sub = StubSubscriberSetup() setup.add_complex_event(event_def=BoboComplexEvent( name=NAME_NFA_A, pattern=stub_pattern_1, action=NoAction())) setup.config_receiver(StrDictValidator()) setup.subscribe_receiver(sub) setup.configure() receiver = setup.get_receiver() receiver.setup() receiver.add_data(DATA_DICT_A) receiver.loop() self.assertIsInstance(sub.receiver_event[0], PrimitiveEvent)