MCPcopy
hub / github.com/sshuttle/sshuttle / test_firewall_command_freebsd

Function test_firewall_command_freebsd

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

Source from the content-addressed store, hash-verified

114@patch('sshuttle.methods.pf.ioctl')
115@patch('sshuttle.methods.pf.pf_get_dev')
116def test_firewall_command_freebsd(mock_pf_get_dev, mock_ioctl, mock_stdout):
117 method = get_method('pf')
118 assert not method.firewall_command("something")
119
120 command = "QUERY_PF_NAT %d,%d,%s,%d,%s,%d\n" % (
121 AF_INET, socket.IPPROTO_TCP,
122 "127.0.0.1", 1025, "127.0.0.2", 1024)
123 assert method.firewall_command(command)
124
125 assert mock_pf_get_dev.mock_calls == [call()]
126 assert mock_ioctl.mock_calls == [
127 call(mock_pf_get_dev(), 0xc04c4417, ANY),
128 ]
129 assert mock_stdout.mock_calls == [
130 call.write('QUERY_PF_NAT_SUCCESS 0.0.0.0,0\n'),
131 call.flush(),
132 ]
133
134
135@patch('sshuttle.methods.pf.pf', OpenBsd())

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