(mock_pf_get_dev, mock_ioctl, mock_stdout)
| 137 | @patch('sshuttle.methods.pf.ioctl') |
| 138 | @patch('sshuttle.methods.pf.pf_get_dev') |
| 139 | def test_firewall_command_openbsd(mock_pf_get_dev, mock_ioctl, mock_stdout): |
| 140 | method = get_method('pf') |
| 141 | assert not method.firewall_command("something") |
| 142 | |
| 143 | command = "QUERY_PF_NAT %d,%d,%s,%d,%s,%d\n" % ( |
| 144 | AF_INET, socket.IPPROTO_TCP, |
| 145 | "127.0.0.1", 1025, "127.0.0.2", 1024) |
| 146 | assert method.firewall_command(command) |
| 147 | |
| 148 | assert mock_pf_get_dev.mock_calls == [call()] |
| 149 | assert mock_ioctl.mock_calls == [ |
| 150 | call(mock_pf_get_dev(), 0xc0504417, ANY), |
| 151 | ] |
| 152 | assert mock_stdout.mock_calls == [ |
| 153 | call.write('QUERY_PF_NAT_SUCCESS 0.0.0.0,0\n'), |
| 154 | call.flush(), |
| 155 | ] |
| 156 | |
| 157 | |
| 158 | def pfctl(args, stdin=None): |
nothing calls this directly
no test coverage detected