-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for message bus #542
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For PDC-2583 I meant a message producer that would be usable with manage.py runserver
and printing the messages (instead of basically dropping them which is what the dummy messenger does).
pdc/apps/utils/__init__.py
Outdated
messenger = MESSENGERS.get(settings.MESSAGE_BUS['MLP'], DummyMessenger)() | ||
|
||
def _init_messenger(): | ||
mpl = settings.MESSAGE_BUS['MLP'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think MPL stands for Messaging Library Provider. mpl
looks like a typo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's typo.
pdc/settings_test.py
Outdated
listener.messages.append((topic, msg)) | ||
|
||
def listen(self): | ||
return TestListener(self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these two classes really be in the settings file? Maybe a comment explaining why would be useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could add special value "test"
for the settings.MESSAGE_BUS['MLP']
and move the classes to pdc/apps/utils/messaging.py
. That way I don't have to modify how the global messenger
variable is initiated.
619e86e
to
47e3434
Compare
Maybe it can be handled more directly by overriding
pdc.apps.utils.messenger
insettings_tests.py
. Not sure which solution is cleaner.This is just single simple test, or more like proof of concept. It doesn't seem the message format is documented anywhere.
Perhaps this is enough for PDC-2583?