Verify deauth command construction and execution.
(client, mock_app_module, mocker)
| 121 | mock_proc.terminate.assert_called_once() |
| 122 | |
| 123 | def test_send_deauth_success(client, mock_app_module, mocker): |
| 124 | """Verify deauth command construction and execution.""" |
| 125 | mocker.patch("routes.wifi.check_tool", return_value=True) |
| 126 | mocker.patch("routes.wifi.get_tool_path", return_value="/usr/bin/aireplay-ng") |
| 127 | mock_run = mocker.patch("routes.wifi.subprocess.run") |
| 128 | mock_run.return_value = MagicMock(returncode=0) |
| 129 | |
| 130 | payload = { |
| 131 | 'bssid': 'AA:BB:CC:DD:EE:FF', |
| 132 | 'count': 10, |
| 133 | 'interface': 'wlan0mon' |
| 134 | } |
| 135 | response = client.post('/wifi/deauth', json=payload) |
| 136 | |
| 137 | assert response.status_code == 200 |
| 138 | args, _ = mock_run.call_args |
| 139 | cmd = args[0] |
| 140 | assert "--deauth" in cmd |
| 141 | assert "10" in cmd |
| 142 | assert "AA:BB:CC:DD:EE:FF" in cmd |
| 143 | |
| 144 | ### --- HANDSHAKE TESTS --- ### |
| 145 |