mock.call.setsockopt

Here are the examples of the python api mock.call.setsockopt taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

Example 1

Project: sshuttle Source File: test_methods_tproxy.py
Function: test_setup_tcp_listener
def test_setup_tcp_listener():
    listener = Mock()
    method = get_method('tproxy')
    method.setup_tcp_listener(listener)
    assert listener.mock_calls == [
        call.setsockopt(0, 19, 1)
    ]

Example 2

Project: sshuttle Source File: test_methods_tproxy.py
Function: test_setup_udp_listener
def test_setup_udp_listener():
    listener = Mock()
    method = get_method('tproxy')
    method.setup_udp_listener(listener)
    assert listener.mock_calls == [
        call.setsockopt(0, 19, 1),
        call.v4.setsockopt(0, 20, 1),
        call.v6.setsockopt(41, 74, 1)
    ]

Example 3

Project: ceilometer Source File: test_collector.py
    def _verify_udp_socket(self, udp_socket):
        conf = self.CONF.collector
        setsocketopt_calls = [mock.call.setsockopt(socket.SOL_SOCKET,
                                                   socket.SO_REUSEADDR, 1),
                              mock.call.setsockopt(socket.SOL_SOCKET,
                                                   socket.SO_REUSEPORT, 1)]
        udp_socket.setsockopt.assert_has_calls(setsocketopt_calls)
        udp_socket.bind.assert_called_once_with((conf.udp_address,
                                                 conf.udp_port))