Loading setup.cfg +0 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,6 @@ include = test = anyio[curio] coverage <5 mocket[speedups] nose2[coverage_plugin] [unittest] Loading tests/unit/test_util.pydeleted 100644 → 0 +0 −57 Original line number Diff line number Diff line # Copyright 2019 Dom Sekotill <dom.sekotill@kodo.org.uk> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """ Test cases for wpa_supplicant.util functions """ import socket import unittest import warnings from unittest.mock import patch import anyio from mocket import Mocket from mocket import MocketEntry from mocket import mocketize from wpa_supplicant import util class AnyIOTests(unittest.TestCase): """ Tests for 'anyio' functions in util """ @mocketize @patch("mocket.mocket.MocketSocket.getsockopt", return_value=0) @patch("mocket.mocket.MocketSocket.connect") def test_connect_unix_datagram(self, mock_connect, mock_getsockopt): """ Check that a socket of the right type is wrapped, bound and connected after a call """ test_path = "/some/path" Mocket.register(MocketEntry(test_path, [])) # Perform the action sock = anyio.run(util.connect_unix_datagram, test_path) # This will pick up changes that may need to be made to the test mocks if mock_getsockopt.call_count != 1: warnings.warn("getsockopt() call count != 1") # The socket MUST be a UNIX DATAGRAM type self.assertEqual(sock.family, socket.AF_UNIX) self.assertEqual(sock.type, socket.SOCK_DGRAM) mock_connect.assert_called_once_with(test_path) Loading
setup.cfg +0 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,6 @@ include = test = anyio[curio] coverage <5 mocket[speedups] nose2[coverage_plugin] [unittest] Loading
tests/unit/test_util.pydeleted 100644 → 0 +0 −57 Original line number Diff line number Diff line # Copyright 2019 Dom Sekotill <dom.sekotill@kodo.org.uk> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """ Test cases for wpa_supplicant.util functions """ import socket import unittest import warnings from unittest.mock import patch import anyio from mocket import Mocket from mocket import MocketEntry from mocket import mocketize from wpa_supplicant import util class AnyIOTests(unittest.TestCase): """ Tests for 'anyio' functions in util """ @mocketize @patch("mocket.mocket.MocketSocket.getsockopt", return_value=0) @patch("mocket.mocket.MocketSocket.connect") def test_connect_unix_datagram(self, mock_connect, mock_getsockopt): """ Check that a socket of the right type is wrapped, bound and connected after a call """ test_path = "/some/path" Mocket.register(MocketEntry(test_path, [])) # Perform the action sock = anyio.run(util.connect_unix_datagram, test_path) # This will pick up changes that may need to be made to the test mocks if mock_getsockopt.call_count != 1: warnings.warn("getsockopt() call count != 1") # The socket MUST be a UNIX DATAGRAM type self.assertEqual(sock.family, socket.AF_UNIX) self.assertEqual(sock.type, socket.SOCK_DGRAM) mock_connect.assert_called_once_with(test_path)