mirror of
https://github.com/hubHarmony/servii-backend.git
synced 2024-11-17 21:40:31 +00:00
[!] DO NOT RUN THIS FILE IN STANDALONE
Signed-off-by: Charles Le Maux <charles.le-maux@epitech.eu>
This commit is contained in:
parent
232657af65
commit
92e5a13ae6
42
unit_test.py
42
unit_test.py
@ -0,0 +1,42 @@
|
||||
import file_manager
|
||||
import firebase_manager
|
||||
|
||||
db = firebase_manager.firestore_database
|
||||
users = firebase_manager.auth.list_users().users
|
||||
|
||||
|
||||
def create_properties_collection(uid, name):
|
||||
"""Create properties collection for a specific server of a user."""
|
||||
properties = {
|
||||
"difficulty": "easy",
|
||||
"gamemode": "survival",
|
||||
"force-gamemode": False,
|
||||
"hardcore": False,
|
||||
"generate-structures": True,
|
||||
"motd": "A Minecraft Server",
|
||||
"pvp": True,
|
||||
"online-mode": True,
|
||||
"max-players": 20,
|
||||
"enable-command-block": False
|
||||
}
|
||||
|
||||
doc_ref = db.document(f'users/{uid}/servers/{name}')
|
||||
#doc_ref.set(properties)
|
||||
doc_ref.delete()
|
||||
|
||||
|
||||
def get_servers(uid):
|
||||
servers_ref = db.collection(f'users/{uid}/servers').stream()
|
||||
servers_names = [doc.id for doc in servers_ref]
|
||||
return servers_names
|
||||
|
||||
|
||||
if __name__ == 'voituredecourse':
|
||||
for user in users:
|
||||
user_id = user.uid
|
||||
servers = get_servers(user_id)
|
||||
for server_id in servers:
|
||||
create_properties_collection(user_id, server_id)
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(file_manager.kebab_to_camel_case("enable-command-block"))
|
Loading…
Reference in New Issue
Block a user