MCPcopy
hub / github.com/sshuttle/sshuttle / test_firewall_command_darwin

Function test_firewall_command_darwin

tests/client/test_methods_pf.py:93–109  ·  view source on GitHub ↗
(mock_pf_get_dev, mock_ioctl, mock_stdout)

Source from the content-addressed store, hash-verified

91@patch('sshuttle.methods.pf.ioctl')
92@patch('sshuttle.methods.pf.pf_get_dev')
93def test_firewall_command_darwin(mock_pf_get_dev, mock_ioctl, mock_stdout):
94 method = get_method('pf')
95 assert not method.firewall_command("something")
96
97 command = "QUERY_PF_NAT %d,%d,%s,%d,%s,%d\n" % (
98 AF_INET, socket.IPPROTO_TCP,
99 "127.0.0.1", 1025, "127.0.0.2", 1024)
100 assert method.firewall_command(command)
101
102 assert mock_pf_get_dev.mock_calls == [call()]
103 assert mock_ioctl.mock_calls == [
104 call(mock_pf_get_dev(), 0xc0544417, ANY),
105 ]
106 assert mock_stdout.mock_calls == [
107 call.write('QUERY_PF_NAT_SUCCESS 0.0.0.0,0\n'),
108 call.flush(),
109 ]
110
111
112@patch('sshuttle.methods.pf.pf', FreeBsd())

Callers

nothing calls this directly

Calls 4

get_methodFunction · 0.90
writeMethod · 0.80
flushMethod · 0.80
firewall_commandMethod · 0.45

Tested by

no test coverage detected