fashionistar-celery-queues / scripts /test_layer1_api.py
FASHIONISTAR CI/CD
🔄 Celery Queues Deploy: 4aae6106b1530c3cc7d7d64f5e3c3e1d5015691d [GitHub Actions]
27c799c
Raw
History Blame
918 Bytes
import requests
import sqlite3
BASE_URL = "http://localhost:8001/api/v1"
DB_PATH = "../db.sqlite3" # Relative to where we run it (fashionistar_backend)
session = requests.Session()
def get_otp_for_email(email):
# Connect to SQLite to grab the OTP for testing
conn = sqlite3.connect(DB_PATH)
cursor = conn.cursor()
cursor.execute("SELECT id FROM authentication_unifieduser WHERE email = ?", (email,))
user_id = cursor.fetchone()[0]
# In locmem cache we can't easily grab it from external python script because locmem is tied to the Django process.
# WAIT! The OTP is stored in Django cache... LocMemCache is per-process.
# To get it, we need to run this script THROUGH django manage.py shell, or we can just write a management command.
pass
# We will rewrite this file as a Django management command to access the cache directly,
# or just run it via `manage.py shell -c "..."`