Commit graph

13 commits

Author SHA1 Message Date
162904f281
[#253] Added support for relational filters on event hooks. 2023-04-27 22:07:02 +02:00
245472a4c5
Better event hooks filters.
- Support for nested attributes on event hook conditions. Things like
  these are now possible:

```
from platypush.event.hook import hook
from platypush.message.event.entities import EntityUpdateEvent

@hook(EntityUpdateEvent, entity={"external_id": "system:cpu"})
def on_cpu_update_event(event: EntityUpdateEvent, **_):
    print(event.args["entity"]["percent"])
```

- The scoring/regex extraction/partial string match logic in
  `_matches_argument` is actually only needed for
  `SpeechRecognizedEvent`. Other events don't need these features, and
  event hooks may be actually triggered unexpectedly in case of partial
  matches. Therefore, the "complex" `_matches_argument` has been moved
  as an override only for `SpeechRecognizedEvent`, and all the other
  events will perform simple key-value matching.
2023-04-26 01:45:58 +02:00
4ed80a0945 More tests improvements 2021-03-06 17:03:50 +01:00
49ad3261f1 Refactored tests to use pytest with fixtures instead of unittest.TestCase 2021-03-06 16:21:28 +01:00
0d806eeb6e - Removed setUp method from test_event_parse - let the parent setUp run and properly start the daemon
- More resilient logic in case some entries in the Zeroconf registry are still loading and the info object is still None
2021-02-27 20:51:48 +01:00
3932fb56c4 test_event_parse must include a config_file, even if it doesn't use it, otherwise the service will fail to start 2021-02-27 17:01:47 +01:00
b4f9472fc5 - Proper expansion of the context variables on functional procedure call
- Expanded and refactored tests framework

- Added test_procedure
2021-02-27 15:01:25 +01:00
531be19a66 .context needs to be imported in test_event_parse to make sure that the configuration is properly initialized 2021-02-24 00:35:41 +01:00
571a8ca9d1 Improvements on HTTP integration test. Plus, removed ApplicationStoppedEvent - it's unreliable and it could be delivered when the bus has already been stopped 2021-02-24 00:23:32 +01:00
Fabio Manganiello
570ef6f109 Replaced EventAction with Procedure to allow more flexibility in event hooks and cronjobs 2018-09-27 01:52:35 +02:00
Fabio Manganiello
252f503e4d Better management of the context and support for proper expression expansion from the context in the action execution through eval 2018-01-07 23:31:19 +01:00
Fabio Manganiello
4c62133378 Updated README 2018-01-03 02:23:25 +01:00
Fabio Manganiello
691a9c8593 Added test for the event/condition matching and parsing logic 2018-01-03 00:16:01 +01:00