Skip to content

Commit

Permalink
test are going on the backlog because it is fucking shit to mock this
Browse files Browse the repository at this point in the history
  • Loading branch information
JonNesvold committed Sep 17, 2024
1 parent afe1466 commit e1f4e58
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 187 deletions.
Binary file added .coverage
Binary file not shown.
30 changes: 15 additions & 15 deletions mrsal/amqp/subclass.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from os import WSTOPSIG
import pika
import json
from ssl import SSLContext
from mrsal.exceptions import MrsalAbortedSetup
from logging import WARNING
from pika.connection import SSLOptions
Expand Down Expand Up @@ -102,20 +102,20 @@ def setup_async_connection(self) -> None:
if self.verbose:
self.log.info(f"Establishing connection to RabbitMQ on {connection_info}")
credentials = pika.PlainCredentials(*self.credentials)

conn_conf = pika.ConnectionParameters(
host=self.host,
port=self.port,
ssl_options=self.get_ssl_context(),
virtual_host=self.virtual_host,
credentials=credentials,
heartbeat=self.heartbeat,
)
try:
self._connection = AsyncioConnection.create_connection(
pika.ConnectionParameters(
host=self.host,
port=self.port,
ssl_options=self.get_ssl_context(),
virtual_host=self.virtual_host,
credentials=credentials,
heartbeat=self.heartbeat,
),
on_done=self.on_connection_open,
on_open_error_callback=self.on_connection_error
)
self._connection = AsyncioConnection(
parameters=conn_conf,
on_open_callback=self.on_connection_open,
on_open_error_callback=self.on_connection_error
)
except (AMQPConnectionError, ChannelClosedByBroker, ConnectionClosedByBroker, StreamLostError) as e:
self.log.error(f"Oh lordy lord I failed connecting to the Rabbit with: {e}")
raise
Expand Down Expand Up @@ -164,7 +164,7 @@ def start_consumer(self,
if self._connection:
self._connection.ioloop.run_forever()
else:
self.log.error('Straigh out of the swamp with no connection! Oh lordy! Something went wrong in the async connection')
self.log.error('Straigh out of the swamp with no connection! Async connection did not activate')

if auto_declare:
if None in (exchange_name, queue_name, exchange_type, routing_key):
Expand Down
172 changes: 0 additions & 172 deletions tests/test_async_mrsal.py

This file was deleted.

0 comments on commit e1f4e58

Please sign in to comment.