Skip to content

Commit

Permalink
Add test to close a connected socket
Browse files Browse the repository at this point in the history
  • Loading branch information
Peque committed Aug 12, 2019
1 parent 35cf67b commit ccaf03d
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions osbrain/tests/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,15 +532,28 @@ def test_has_socket(nsproxy):
assert a0.has_socket('pub')


def test_close(nsproxy):
def test_close_bound(nsproxy):
"""
Test that closing a socket removes it from the socket entry.
Test that closing a bound socket removes it from the socket entry.
"""
a0 = run_agent('a0')
a0.bind('PUB', alias='pub')
a0.bind('PUB', alias='bound')

a0.close('pub')
assert not a0.has_socket('pub')
a0.close('bound')
assert not a0.has_socket('bound')


def test_close_connected(nsproxy):
"""
Test that closing a connected socket removes it from the socket entry.
"""
a0 = run_agent('a0')
a1 = run_agent('a1')
pub = a0.bind('PUB', alias='pub')
a1.connect(pub, alias='connected', handler=echo_handler)

a1.close('connected')
assert not a1.has_socket('connected')


def test_close_socket_poller_cleanup(nsproxy):
Expand Down

0 comments on commit ccaf03d

Please sign in to comment.