def test_bind_by_name(self, llc, raw, ldl, dlc):
with pytest.raises(nfc.llcp.Error) as excinfo:
llc.bind(dlc, 'urn:nfc:snep')
assert excinfo.value.errno == errno.EFAULT
llc.bind(dlc, 'urn:nfc:sn:snep')
assert llc.getsockname(dlc) == 4
with pytest.raises(nfc.llcp.Error) as excinfo:
llc.bind(ldl, 'urn:nfc:sn:snep')
assert excinfo.value.errno == errno.EADDRINUSE
llc.bind(ldl, 'urn:nfc:xsn:nfcpy.org:service')
assert llc.getsockname(ldl) == 16
for sap in range(17, 32):
sock = llc.socket(nfc.llcp.llc.RAW_ACCESS_POINT)
llc.bind(sock, 'urn:nfc:sn:use_sap-{}'.format(sap))
assert llc.getsockname(sock) == sap
with pytest.raises(nfc.llcp.Error) as excinfo:
llc.bind(raw, 'urn:nfc:sn:sap-32')
assert excinfo.value.errno == errno.EADDRNOTAVAIL
评论列表
文章目录