Beispiel #1
0
    def test_registering_custom_events_works(self):
        inst = Sijax()

        event_name = "my_event"
        event_callback = lambda obj_response: obj_response.alert("Event")

        self.assertFalse(inst.has_event(event_name), "Custom event registered")

        inst.register_event(event_name, event_callback)

        self.assertTrue(inst.has_event(event_name), "Failed to register event")
Beispiel #2
0
    def test_registering_custom_events_works(self):
        inst = Sijax()

        event_name = "my_event"
        event_callback = lambda obj_response: obj_response.alert("Event")

        self.assertFalse(inst.has_event(event_name), "Custom event registered")

        inst.register_event(event_name, event_callback)

        self.assertTrue(inst.has_event(event_name), "Failed to register event")
Beispiel #3
0
 def test_events_have_default_handlers(self):
     inst = Sijax()
     cls = inst.__class__
     events = [
         getattr(cls, attr) for attr in dir(cls)
         if attr.startswith('EVENT_')
     ]
     for event in events:
         self.assertTrue(inst.has_event(event), "No handler for %s" % event)
Beispiel #4
0
 def test_events_have_default_handlers(self):
     inst = Sijax()
     cls = inst.__class__
     events = [getattr(cls, attr) for attr in dir(cls) if attr.startswith('EVENT_')]
     for event in events:
         self.assertTrue(inst.has_event(event), "No handler for %s" % event)