diff --git a/get_columns.py b/get_columns.py new file mode 100644 index 0000000..593c6ba --- /dev/null +++ b/get_columns.py @@ -0,0 +1,8 @@ +import os +import django +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings') +django.setup() + +from api.models import SupplierProfile +columns = [f.name for f in SupplierProfile._meta.get_fields()] +print("Columns:", columns) diff --git a/test_profile_update.py b/test_profile_update.py new file mode 100644 index 0000000..1a12f14 --- /dev/null +++ b/test_profile_update.py @@ -0,0 +1,7 @@ +import os +import django +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings') +django.setup() + +from api.models import SupplierProfile +print("Supplier Profiles:", list(SupplierProfile.objects.all().values())) diff --git a/test_registration.py b/test_registration.py new file mode 100644 index 0000000..4dca20e --- /dev/null +++ b/test_registration.py @@ -0,0 +1,33 @@ +import requests + +phone = "9600494039" + +# 1. Register +res = requests.post("http://localhost:8000/api/auth/register/", json={"phone": phone}) +if res.status_code == 400 and "already exists" in res.text: + print("User already exists, logging in instead...") + res = requests.post("http://localhost:8000/api/auth/login/", json={"phone": phone}) +else: + print("Register:", res.status_code, res.text) + # verify otp + res = requests.post("http://localhost:8000/api/auth/verify-otp/", json={"phone": phone, "otp": "123456"}) + print("Verify:", res.status_code, res.text) + res = requests.post("http://localhost:8000/api/auth/login/", json={"phone": phone}) + +print("Login:", res.status_code, res.text) +token = res.json().get('access') + +# 2. Update Profile +headers = {"Authorization": f"Bearer {token}", "Content-Type": "application/json"} +payload = { + "is_profile_complete": True, + "business_type": "individual_maker", + "store_slug": "heritage-crafts-9600", + "street": "123 Test Street", + "city": "Test City", + "state": "Test State", + "pincode": "123456", + "store_name": "Heritage Crafts" +} +res = requests.put("http://localhost:8000/api/profile/", headers=headers, json=payload) +print("Update:", res.status_code, res.text)