toddlers/tests/plugins/test_debug.py
Nils Philippsen 7fe0937190 Using real objects is considered polite
Previously, ToddlerBase and derived classes were used directly, but none
of the methods is marked as a class or static method. Amazingly enough,
it worked regardless. It's useful to have a constructor, though, so do
things conventionally.

As we can't just monkey-patch the classes then, use the shared `toddler`
fixture which creates the object for the test methods that need it.

Signed-off-by: Nils Philippsen <nils@redhat.com>
2020-07-17 17:39:28 +02:00

17 lines
436 B
Python

import fedora_messaging.api
from toddlers.plugins.debug import DebugToddler
class TestDebugToddler:
toddler_cls = DebugToddler
def test_accepts_topic(self, toddler):
assert toddler.accepts_topic("foo.bar")
def test_process(self, toddler):
msg = fedora_messaging.api.Message()
msg.id = 123
msg.topic = "toddlers.test.topic"
assert toddler.process(config={}, message=msg) is None