-
Notifications
You must be signed in to change notification settings - Fork 33
add bouncer/net-tests to ooniapi under new router bouncer #1036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
related to #807 |
I modified the tests to expect any error (other than http response 200) because FastAPI returns HTTP error 422 Unprocessable Entity instead of 400, as the tests do not supply a request that the model can validate
| def test_bouncer_net_tests_bad_request1(client): | ||
| resp = client.post("/bouncer/net-tests") | ||
| # XXX: fastapi returns 422 Unprocessable Entity; expected result was 400 in old test | ||
| assert resp.status_code != 200 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a last thing, let's also change this to assert resp.status_code == 400 and add a comment to specify that it's for backward compatibility reasons
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| j = {"net-tests": []} | ||
| resp = client.post("/bouncer/net-tests", json=j) | ||
| # XXX: fastapi returns 422 Unprocessable Entity; expected result was 400 in old test | ||
| assert resp.status_code != 200 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous comment: https://github.com/ooni/backend/pull/1036/files#r2533818398
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
Hey nice work, thanks for putting this together! Let's fix the expected status code in the test and we're good to go |
* in test_settings, add clickhouse_server fixture (#1028) * in test_settings, add clickhouse_server fixture * delay and decrease probe frequency of is_clickhouse_running to reduce logspam * remove docker_ip and docker_services included by clickhouse_server * add collectors to ooniapi (#1032) * add collectors to ooniapi * Make method "GET" on route for list_collectors * Use SettingsDep from ooniprobe.dependencies * add geolookup to ooniapi probe services (#1031) * add geolookup to ooniapi probe services this includes a small refactor to make the probe_geoip method re-usable * Replace class docstring with pydantic.Field annotation * use pydantic field validation for geolookup endpoint * probe_services: validate probe_geoip; add type GeoLookupResult * monkeypatch lookup_probe_cc and lookup_probe_network to provide static responses * add bouncer/net-tests to ooniapi under new router bouncer (#1036) * add bouncer/net-tests to ooniapi under new router bouncer * fix pylint import complaints * let fastapi validate input * exclude unset parameters in bouncer/net-tests * add bouncer tests from api/tests/integ/test_probe_services.py I modified the tests to expect any error (other than http response 200) because FastAPI returns HTTP error 422 Unprocessable Entity instead of 400, as the tests do not supply a request that the model can validate * raise HTTPException with status 400 for backwards-compatibility * check status code on error is 400 for backwards compatibility with old probes * Fix bad geoip reporting (#1022) * Add logging to failing comparision function * Trigger CI * Trigger CI * Fix bad db_asn logging * Improve logging of geoip mismatches * Fix extract_probe_ipaddr * Cusum changepoint api (#1027) * Add initial endpoint shape for event detector changepoints * Add cusum changepoint list endpoint * Remove unused request model * Add event detector changepoint * Fix event detector table migration for tests * Add basic test for changepoint endpoint * Add basic filtering test to changepoint endpoint * Remove unused log * Add tests to check filtering by date * Add utils module with useful types * Remove unused types * Remove unused import * Add enum for change direction * Black reformat * Add testing data from the DB * Remove out dated comment * Trigger ci * fix typo in changepoint api endpoint * trigger ci * Modify changepoints table to add block_type column * replace bad quotes * Add block_type field to changepoints API * Add prioritization CRUD methods (#1040) * Add prioritization CRUD methods /api/_/show_countries_prioritization /api/_/debug_prioritization * rename routers/prio to routers/prio_crud * use raw string in regex * S3 config parameter (#1039) * Add config bucket setting and function to read file from bucket * trigger ci --------- Co-authored-by: Luis Diaz <41093870+LDiazN@users.noreply.github.com>
No description provided.