Skip to content

Commit

Permalink
add callback attr name test
Browse files Browse the repository at this point in the history
  • Loading branch information
nozik committed Dec 20, 2021
1 parent 68f9783 commit 26399c3
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
from wrapt import BoundFunctionWrapper

from opentelemetry.instrumentation.pika import PikaInstrumentor
from opentelemetry.instrumentation.pika.pika_instrumentor import (
_consumer_callback_attribute_name,
)
from opentelemetry.instrumentation.pika.utils import dummy_callback
from opentelemetry.trace import Tracer

Expand Down Expand Up @@ -113,3 +116,9 @@ def test_uninstrument_channel_functions(self) -> None:
self.channel.basic_publish._original_function = original_function
PikaInstrumentor._uninstrument_channel_functions(self.channel)
self.assertEqual(self.channel.basic_publish, original_function)

def test_consumer_callback_attribute_name(self) -> None:
with mock.patch("pika.__version__", "1.0.0"):
assert _consumer_callback_attribute_name() == "on_message_callback"
with mock.patch("pika.__version__", "0.12.0"):
assert _consumer_callback_attribute_name() == "consumer_cb"

0 comments on commit 26399c3

Please sign in to comment.