예제 #1
0
 def test_sockopt(self, tco):
     assert tco.getsockopt(nfc.llcp.SO_RCVBUF) == 1
     tco.setsockopt(nfc.llcp.SO_RCVBUF, 2)
     assert tco.getsockopt(nfc.llcp.SO_RCVBUF) == 2
     tco.close()
     with pytest.raises(nfc.llcp.Error) as excinfo:
         tco.setsockopt(nfc.llcp.SO_RCVBUF, 2)
     assert excinfo.value.errno == errno.ESHUTDOWN
     with pytest.raises(nfc.llcp.Error) as excinfo:
         tco.getsockopt(nfc.llcp.SO_RCVBUF)
     assert excinfo.value.errno == errno.ESHUTDOWN
예제 #2
0
 def test_sockopt(self, tco):
     assert tco.getsockopt(nfc.llcp.SO_RCVBUF) == 1
     tco.setsockopt(nfc.llcp.SO_RCVBUF, 2)
     assert tco.getsockopt(nfc.llcp.SO_RCVBUF) == 2
     tco.close()
     with pytest.raises(nfc.llcp.Error) as excinfo:
         tco.setsockopt(nfc.llcp.SO_RCVBUF, 2)
     assert excinfo.value.errno == errno.ESHUTDOWN
     with pytest.raises(nfc.llcp.Error) as excinfo:
         tco.getsockopt(nfc.llcp.SO_RCVBUF)
     assert excinfo.value.errno == errno.ESHUTDOWN
예제 #3
0
 def test_sockopt(self, tco):
     assert tco.getsockopt(nfc.llcp.SO_SNDMIU) == tco.send_miu
     assert tco.getsockopt(nfc.llcp.SO_RCVMIU) == tco.recv_miu
     with pytest.raises(NotImplementedError) as excinfo:
         tco.setsockopt(nfc.llcp.SO_SNDBUF, 0)
     assert str(excinfo.value) == "SO_SNDBUF can not be set"
     assert tco.getsockopt(nfc.llcp.SO_SNDBUF) == 1
     tco.setsockopt(nfc.llcp.SO_RCVBUF, 2)
     assert tco.getsockopt(nfc.llcp.SO_RCVBUF) == 2
     assert tco.getsockopt(-1) is None
     with pytest.raises(ValueError) as excinfo:
         tco.setsockopt(-1, 0)
     assert str(excinfo.value) == "invalid option value"
예제 #4
0
 def test_sockopt(self, tco):
     assert tco.getsockopt(nfc.llcp.SO_SNDMIU) == tco.send_miu
     assert tco.getsockopt(nfc.llcp.SO_RCVMIU) == tco.recv_miu
     with pytest.raises(NotImplementedError) as excinfo:
         tco.setsockopt(nfc.llcp.SO_SNDBUF, 0)
     assert str(excinfo.value) == "SO_SNDBUF can not be set"
     assert tco.getsockopt(nfc.llcp.SO_SNDBUF) == 1
     tco.setsockopt(nfc.llcp.SO_RCVBUF, 2)
     assert tco.getsockopt(nfc.llcp.SO_RCVBUF) == 2
     assert tco.getsockopt(-1) is None
     with pytest.raises(ValueError) as excinfo:
         tco.setsockopt(-1, 0)
     assert str(excinfo.value) == "invalid option value"
예제 #5
0
 def test_sockopt(self, tco):
     assert tco.getsockopt(nfc.llcp.SO_SNDBUF) == 1
     assert tco.getsockopt(nfc.llcp.SO_RCVBUF) == 1
     assert tco.getsockopt(nfc.llcp.SO_SNDMIU) == 128
     assert tco.getsockopt(nfc.llcp.SO_RCVMIU) == 128
     assert tco.getsockopt(nfc.llcp.SO_SNDBSY) is False
     assert tco.getsockopt(nfc.llcp.SO_RCVBSY) is False
     tco.setsockopt(nfc.llcp.SO_RCVMIU, 200)
     tco.setsockopt(nfc.llcp.SO_RCVBUF, 2)
     tco.setsockopt(nfc.llcp.SO_RCVBSY, True)
     assert tco.getsockopt(nfc.llcp.SO_RCVBUF) == 2
     assert tco.getsockopt(nfc.llcp.SO_RCVMIU) == 200
     assert tco.getsockopt(nfc.llcp.SO_RCVBSY) is True
     with pytest.raises(NotImplementedError) as excinfo:
         tco.setsockopt(nfc.llcp.SO_SNDBUF, 2)
     assert str(excinfo.value) == "SO_SNDBUF can not be set"
예제 #6
0
 def test_sockopt(self, tco):
     assert tco.getsockopt(nfc.llcp.SO_SNDBUF) == 1
     assert tco.getsockopt(nfc.llcp.SO_RCVBUF) == 1
     assert tco.getsockopt(nfc.llcp.SO_SNDMIU) == 128
     assert tco.getsockopt(nfc.llcp.SO_RCVMIU) == 128
     assert tco.getsockopt(nfc.llcp.SO_SNDBSY) is False
     assert tco.getsockopt(nfc.llcp.SO_RCVBSY) is False
     tco.setsockopt(nfc.llcp.SO_RCVMIU, 200)
     tco.setsockopt(nfc.llcp.SO_RCVBUF, 2)
     tco.setsockopt(nfc.llcp.SO_RCVBSY, True)
     assert tco.getsockopt(nfc.llcp.SO_RCVBUF) == 2
     assert tco.getsockopt(nfc.llcp.SO_RCVMIU) == 200
     assert tco.getsockopt(nfc.llcp.SO_RCVBSY) is True
     with pytest.raises(NotImplementedError) as excinfo:
         tco.setsockopt(nfc.llcp.SO_SNDBUF, 2)
     assert str(excinfo.value) == "SO_SNDBUF can not be set"