Test error when source IP not in allow list.
(self)
| 254 | assert 'truncated' in str(exc_info.value) |
| 255 | |
| 256 | def test_forbidden_ip(self): |
| 257 | """Test error when source IP not in allow list.""" |
| 258 | packet = make_uwsgi_packet({'REQUEST_METHOD': 'GET', 'PATH_INFO': '/'}) |
| 259 | unreader = IterUnreader([packet]) |
| 260 | cfg = MockConfig(uwsgi_allow_ips=['192.168.1.1']) |
| 261 | |
| 262 | with pytest.raises(ForbiddenUWSGIRequest) as exc_info: |
| 263 | UWSGIRequest(cfg, unreader, ('10.0.0.1', 12345)) |
| 264 | assert exc_info.value.code == 403 |
| 265 | assert '10.0.0.1' in str(exc_info.value) |
| 266 | |
| 267 | def test_allowed_ip_wildcard(self): |
| 268 | """Test that wildcard allows any IP.""" |
nothing calls this directly
no test coverage detected