servii-backend/unit_test.py

47 lines
961 B
Python
Raw Normal View History

2024-09-06 15:33:46 +00:00
import asyncio
import firebase_manager
def ban_user(user_id: str):
try:
firebase_manager.auth.update_user(user_id, disabled=False)
2024-08-15 08:49:41 +00:00
print("Banned : " + user_id)
except Exception as e:
2024-08-15 08:49:41 +00:00
print("Error banning user " + user_id, "|", str(e), type(e).__name__)
2024-08-11 09:02:10 +00:00
2024-09-06 15:37:41 +00:00
async def one() -> int:
2024-09-06 15:33:46 +00:00
return 1
2024-09-06 15:37:41 +00:00
async def two() -> int:
2024-09-06 15:33:46 +00:00
await asyncio.sleep(2)
return 2
2024-09-06 15:37:41 +00:00
async def three() -> int:
2024-09-06 15:33:46 +00:00
await asyncio.sleep(3)
return 3
coroutines = [
2024-09-06 15:37:41 +00:00
one(),
two(),
three()
2024-09-06 15:33:46 +00:00
]
async def main() -> None:
results = await asyncio.gather(*coroutines)
#for result in results:
# print(result)
print(f"0: {results[0]}")
print(f"1: {results[1]}")
print(f"2: {results[2]}")
if __name__ == '__main__':
#ban_user("MpkbDMOO8PQddQgB5VgBQdTMWF53")
2024-08-24 11:38:22 +00:00
#file_manager.log_action("gqZN3eCHF3V2er3Py3rlgk8u2t83", "test", "DeleteServer")
#firebase_manager.set_servers_not_running()
2024-09-06 15:33:46 +00:00
asyncio.run(main())