mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-29 16:14:42 +00:00
* chore: update auth * chore: password changes * chore: make changes in oss code * chore: login * chore: get to a running state * fix: migration inital commit * fix: signoz cloud intgtn tests * fix: minor fixes * chore: sso code fixed with org domain * fix: tests * fix: ee auth api's * fix: changes in name * fix: return user in login api * fix: address comments * fix: validate password * fix: handle get domain by email properly * fix: move authomain to usermodule * fix: use displayname instead of hname * fix: rename back endpoints * fix: update telemetry * fix: correct errors * fix: test and fix the invite endpoints * fix: delete all things related to user in store * fix: address issues * fix: ee delete invite * fix: rename func * fix: update user and update role * fix: update role * fix: login and invite changes * fix: return org name in users response * fix: update user role * fix: nil check * fix: getinvite and update role * fix: sso * fix: getinvite use sso ctx * fix: use correct sourceurl * fix: getsourceurl from req payload * fix: update created_at * fix: fix reset password * fix: sso signup and token password change * fix: don't delete last admin * fix: reset password and migration * fix: migration * fix: reset password for sso users * fix: clean up invite * fix: migration * fix: update claims and store code * fix: use correct error * fix: proper nil checks * fix: make migration multitenant * fix: address comments * fix: minor fixes * fix: test * fix: rename reset password --------- Co-authored-by: Vikrant Gupta <vikrant@signoz.io>
57 lines
1.5 KiB
Python
57 lines
1.5 KiB
Python
from http import HTTPStatus
|
|
|
|
import requests
|
|
|
|
from fixtures import types
|
|
|
|
|
|
def test_api_key(signoz: types.SigNoz, get_jwt_token) -> None:
|
|
admin_token = get_jwt_token("admin@integration.test", "password")
|
|
|
|
response = requests.post(
|
|
signoz.self.host_config.get("/api/v1/pats"),
|
|
headers={"Authorization": f"Bearer {admin_token}"},
|
|
json={
|
|
"name": "admin",
|
|
"role": "ADMIN",
|
|
"expiresInDays": 1,
|
|
},
|
|
)
|
|
|
|
assert response.status_code == HTTPStatus.OK
|
|
pat_response = response.json()
|
|
assert "data" in pat_response
|
|
assert "token" in pat_response["data"]
|
|
|
|
response = requests.get(
|
|
signoz.self.host_config.get("/api/v1/user"),
|
|
timeout=2,
|
|
headers={"SIGNOZ-API-KEY": f"{pat_response["data"]["token"]}"},
|
|
)
|
|
|
|
assert response.status_code == HTTPStatus.OK
|
|
|
|
user_response = response.json()
|
|
found_user = next(
|
|
(user for user in user_response["data"] if user["email"] == "admin@integration.test"),
|
|
None,
|
|
)
|
|
|
|
response = requests.get(
|
|
signoz.self.host_config.get("/api/v1/pats"),
|
|
headers={"SIGNOZ-API-KEY": f"{pat_response["data"]["token"]}"},
|
|
)
|
|
|
|
assert response.status_code == HTTPStatus.OK
|
|
assert "data" in response.json()
|
|
|
|
found_pat = next(
|
|
(pat for pat in response.json()["data"] if pat["userId"] == found_user["id"]),
|
|
None,
|
|
)
|
|
|
|
assert found_pat is not None
|
|
assert found_pat["userId"] == found_user["id"]
|
|
assert found_pat["name"] == "admin"
|
|
assert found_pat["role"] == "ADMIN"
|