Tests / test (push) Canceled after 0s
Native crypto / native-crypto (push) Canceled after 0s
Release (main) / android (oneme) (push) Canceled after 0s
Release (main) / android (qlyra) (push) Canceled after 0s
Release (main) / windows (push) Canceled after 0s
Release (main) / linux (push) Canceled after 0s
Release (main) / macos (push) Canceled after 0s
Release (main) / ios (push) Canceled after 0s
Release (main) / release (push) Canceled after 0s
20 lines
1.1 KiB
Python
20 lines
1.1 KiB
Python
"""Delete only the reserved identities created by this release's tests."""
|
|
from pathlib import Path
|
|
import json,sqlite3,urllib.request,uuid
|
|
from admin_http import AdminHttp
|
|
root=Path('/mnt/data/ikar_server')
|
|
with sqlite3.connect(f'file:{root / "shared/data/ikar.db"}?mode=ro',uri=True) as db:
|
|
candidates=db.execute('select Id,NormalizedPhoneNumber,DisplayName from Users where IsBot=0 and IsBlocked=0').fetchall()
|
|
# The compatibility layer stores the last ten digits. Other smoke-test clients
|
|
# delete their own accounts in their finally blocks; only this emulator remains.
|
|
ids=[user_id for user_id,phone,name in candidates if phone=='2025550101' and name=='IKAR']
|
|
if ids:
|
|
settings=dict(line.split('=',1) for line in (root/'shared/server.env').read_text().splitlines() if '=' in line)
|
|
admin=AdminHttp(); admin.login(settings)
|
|
try:
|
|
for user_id in ids:
|
|
status,_=admin.request(f'/admin/api/users/{uuid.UUID(user_id)}','DELETE',reason='Release smoke-test identity cleanup')
|
|
assert status==204
|
|
finally: admin.logout()
|
|
print(json.dumps({'reservedTestAccountsDeleted':len(ids)}))
|