mirror of https://github.com/Shizmob/pydle.git
tests: Test reconnect delay calculation.
This commit is contained in:
parent
b8c18ec8fa
commit
9b4ab3fd13
|
@ -35,6 +35,20 @@ def test_client_reconnect_delay(server, client):
|
|||
time.sleep(1.1)
|
||||
assert client.connected
|
||||
|
||||
@with_client()
|
||||
def test_client_reconnect_delay_calculation(server, client):
|
||||
client.RECONNECT_DELAYED = False
|
||||
assert client._reconnect_delay() == 0
|
||||
|
||||
client.RECONNECT_DELAYED = True
|
||||
for expected_delay in client.RECONNECT_DELAYS:
|
||||
delay = client._reconnect_delay()
|
||||
assert delay == expected_delay
|
||||
|
||||
client._reconnect_attempts += 1
|
||||
|
||||
assert client._reconnect_delay() == client.RECONNECT_DELAYS[-1]
|
||||
|
||||
@with_client()
|
||||
def test_client_disconnect_on_connect(server, client):
|
||||
client.disconnect = Mock()
|
||||
|
|
Loading…
Reference in New Issue