mirror of
https://github.com/bec-project/bec_atlas.git
synced 2025-07-14 07:01:48 +02:00
tests: removed docker-compose tests and moved instead to fakeredis and mongomock
This commit is contained in:
29
backend/tests/export_test_data.py
Normal file
29
backend/tests/export_test_data.py
Normal file
@ -0,0 +1,29 @@
|
||||
import os
|
||||
|
||||
|
||||
def export_mongodb_data(host: str, port: int):
|
||||
"""Export data from MongoDB to a JSON file."""
|
||||
|
||||
collections = [
|
||||
"bec_access_profiles",
|
||||
"deployment_access",
|
||||
"deployment_credentials",
|
||||
"deployments",
|
||||
"fs.chunks",
|
||||
"fs.files",
|
||||
"scans",
|
||||
"sessions",
|
||||
"user_credentials",
|
||||
"users",
|
||||
]
|
||||
|
||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
for collection in collections:
|
||||
os.system(
|
||||
f"mongoexport --host {host} --port {port} --db bec_atlas --collection {collection} --jsonArray --out {current_dir}/test_data/bec_atlas.{collection}.json"
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
export_mongodb_data("localhost", 27017)
|
Reference in New Issue
Block a user