-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
115 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
from queuebie import message_registry | ||
from queuebie.messages import Event | ||
from testapp.messages.commands.my_commands import MyCommand | ||
from testapp.messages.events.my_events import MyEvent | ||
from testapp.messages.commands.my_commands import DoSomething | ||
from testapp.messages.events.my_events import SomethingHappened | ||
|
||
|
||
@message_registry.register_command(command=MyCommand) | ||
def handle_my_command(*, context: MyCommand.Context) -> list[Event] | Event: | ||
return MyEvent(context=MyEvent.Context(other_var=context.my_var + 1)) | ||
@message_registry.register_command(command=DoSomething) | ||
def handle_my_command(*, context: DoSomething.Context) -> list[Event] | Event: | ||
return SomethingHappened(context=SomethingHappened.Context(other_var=context.my_var + 1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
from queuebie import message_registry | ||
from queuebie.messages import Command | ||
from testapp.messages.events.my_events import MyEvent | ||
from testapp.messages.events.my_events import SomethingHappened | ||
|
||
|
||
@message_registry.register_event(event=MyEvent) | ||
def handle_my_event(*, context: MyEvent.Context) -> list[Command] | Command: | ||
@message_registry.register_event(event=SomethingHappened) | ||
def handle_my_event(*, context: SomethingHappened.Context) -> list[Command] | Command: | ||
return [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,8 @@ | ||
import dataclasses | ||
|
||
from queuebie.messages import Command, Event | ||
from queuebie.runner import handle_message | ||
|
||
|
||
class TestCommand(Command): | ||
@dataclasses.dataclass | ||
class Context: | ||
my_var: int | ||
|
||
|
||
class CommandTested(Event): | ||
@dataclasses.dataclass | ||
class Context: | ||
my_var: int | ||
from testapp.messages.commands.my_commands import DoSomething | ||
|
||
|
||
def test_handle_message_pass_single_message(): | ||
# TODO: finish me | ||
handle_message(message_list=TestCommand(context=TestCommand.Context(my_var=1))) | ||
handle_message(message_list=DoSomething(context=DoSomething.Context(my_var=1))) | ||
assert 1 == 0 # noqa: PLR0133 |