mirror of
https://github.com/langgenius/dify-plugin-sdks.git
synced 2026-07-23 02:45:37 -04:00
b182fd2668
- Refactored `TriggerInvokeResponse` to use `Mapping[str, Any]` for event representation. - Renamed `properties` to `variables` in the `Event` class for clarity and updated the description accordingly. - Expanded the event options in the GitHub trigger configuration to allow selection of all events. - Removed the deprecated `issue_comment` trigger implementation and its associated files. - Bumped version in `manifest.yaml` to 0.0.9 to reflect these changes. These updates improve the flexibility and clarity of the GitHub trigger integration, allowing for a broader range of event handling.
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
from collections.abc import Mapping
|
|
from concurrent.futures import ThreadPoolExecutor
|
|
|
|
from werkzeug import Request
|
|
|
|
from dify_plugin.core.runtime import Session
|
|
from dify_plugin.core.server.stdio.request_reader import StdioRequestReader
|
|
from dify_plugin.core.server.stdio.response_writer import StdioResponseWriter
|
|
from dify_plugin.entities.trigger import Event, TriggerRuntime
|
|
from dify_plugin.interfaces.trigger import TriggerEvent
|
|
|
|
|
|
def test_construct_trigger():
|
|
"""
|
|
Test the constructor of Trigger
|
|
|
|
NOTE:
|
|
- This test is to ensure that the constructor of Trigger is not overridden.
|
|
- And ensure a breaking change will be detected by CI.
|
|
"""
|
|
|
|
class TriggerImpl(TriggerEvent):
|
|
def _trigger(self, request: Request, parameters: Mapping) -> Event:
|
|
return Event(variables={})
|
|
|
|
session = Session(
|
|
session_id="test",
|
|
executor=ThreadPoolExecutor(max_workers=1),
|
|
reader=StdioRequestReader(),
|
|
writer=StdioResponseWriter(),
|
|
)
|
|
|
|
trigger = TriggerImpl(runtime=TriggerRuntime(credentials={}, session_id="test"), session=session)
|
|
assert trigger is not None
|