Commit 3a6c0593 authored by Robin Obůrka's avatar Robin Obůrka Committed by Robin Obůrka

network: Fix detection of undefined socket and add test for it

parent 2a5d8ccd
......@@ -223,6 +223,9 @@ class SN:
else:
sock_name, sock_type = request, None
if sock_name not in self.sockets:
raise SockConfigError("Requesting undefined socket")
socket = self.sockets[sock_name]
ret.append(socket.build(self.context, sock_name, sock_type))
......
......@@ -14,6 +14,10 @@ def test_empty_args_native(zmq_context):
with pytest.raises(SystemExit):
ctx = sn.SN(zmq_context)
def test_undefined_resource(zmq_context):
with pytest.raises(sn.SockConfigError):
ctx = sn.SN(zmq_context, args="--resource out,connect,PUSH,sentinel.cz,7700".split(" "))
assert ctx.get_socket("in")
@pytest.mark.parametrize("bad_arg", [
"--resource",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment