(mock_pf_get_dev, mock_ioctl, mock_stdout)
| 114 | @patch('sshuttle.methods.pf.ioctl') |
| 115 | @patch('sshuttle.methods.pf.pf_get_dev') |
| 116 | def 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()) |
nothing calls this directly
no test coverage detected