-
Notifications
You must be signed in to change notification settings - Fork 11
/
queues_test.py
45 lines (35 loc) · 1.26 KB
/
queues_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# -*- coding: utf-8 -*-
import pytest
from brewtils.queues import PikaClient
host = "localhost"
port = 5672
user = "user"
password = "password"
class TestPikaClient(object):
@pytest.fixture
def client(self):
return PikaClient(host=host, port=port, user=user, password=password)
def test_connection_parameters(self, client):
params = client.connection_parameters()
assert params.host == host
assert params.port == port
params = client.connection_parameters(host="another_host")
assert params.host == "another_host"
assert params.port == port
assert params.heartbeat == 3600
def test_connection_parameters_heartbeat(self, client):
assert client.connection_parameters(heartbeat=100).heartbeat == 100
assert client.connection_parameters(heartbeat_interval=100).heartbeat == 100
assert (
client.connection_parameters(
heartbeat=100, heartbeat_interval=200
).heartbeat
== 100
)
def test_connection_url(self, client):
url = client.connection_url
assert url.startswith("amqp://") is True
assert user in url
assert password in url
assert host in url
assert str(port) in url