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