Skip to content

Commit

Permalink
Add login token to update testing
Browse files Browse the repository at this point in the history
  • Loading branch information
LDiazN committed Jan 17, 2025
1 parent 884cb70 commit a76a17c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ooniapi/services/ooniprobe/tests/test_probe_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,23 @@ def test_update(client : TestClient, jwt_encryption_key):
# Update will just say ok to anything you send, no matter
# the data

# We can use whatever string for the client_id path parameter,
# but we use the login token to make sure that the returned token
# works properly with the update endpoint
c = _register(client)
client_id = c["client_id"]
c = postj(client, "/api/v1/login", username=client_id, password="some_pswd")
token = c['token']

data = _update_data()
data = _get_update_data()
resp = client.put(f"/api/v1/update/{token}",json=data)
assert resp.status_code == 200
json = resp.json()
assert "status" in json
assert json['status'] == "ok"


def _update_data() -> Dict[str, str]:
def _get_update_data() -> Dict[str, str]:
return {
"probe_cc": "IT",
"probe_asn": "AS1234",
Expand Down

0 comments on commit a76a17c

Please sign in to comment.