cuatrolabs-scm-ms / tests /test_create_and_list.sh
MukeshKapoor25's picture
backup
1dcf965
#!/bin/bash
# Test script to create taxonomy data and then list it
JWT_TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3Jfc3VwZXJhZG1pbl8wMDEiLCJ1c2VybmFtZSI6InN1cGVyYWRtaW4iLCJyb2xlIjoic3VwZXJfYWRtaW4iLCJtZXJjaGFudF9pZCI6ImNvbXBhbnlfY3VhdHJvX2JlYXV0eV9sdGQiLCJleHAiOjE3NjU1NjU0MzMsInR5cGUiOiJhY2Nlc3MifQ.sEH9v_egOvxrHkVIqOxS2zyR0b1YCJOuKW-6_oM8n2k"
echo "๐Ÿš€ Step 1: Creating taxonomy data..."
curl -X 'POST' \
'http://127.0.0.1:8000/taxonomy/' \
-H 'accept: application/json' \
-H "Authorization: Bearer $JWT_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"brands": ["LOreal Professional", "Schwarzkopf", "Kerastase", "Olaplex"],
"categories": ["Hair", "Skin", "Nails", "Spa", "Makeup", "Foot Care"],
"lines": ["Hair Care", "Hair Styling", "Facials", "Body Treatments"],
"classes": ["Premium", "Luxury", "Basic", "VIP"],
"job_role": ["Senior Stylist", "Director", "Receptionist", "Manager"],
"specializations": ["Hairdresser", "Nail Technician", "Esthetician"],
"languages": ["English", "Hindi", "Tamil"],
"customer_group": ["VIP", "Regular", "Premium", "Gold"],
"pos_tender_modes": ["Cash", "Credit Card", "Debit Card", "UPI"],
"payment_types": ["Cash and Carry", "Credit"],
"payment_methods": ["Bank Transfer", "Cash", "Cheque"],
"asset_location": ["Store Floor", "Warehouse", "Back Office"],
"asset_category": ["Electronics", "Furniture", "Equipment"],
"stock_bin_location": ["A1-01", "B2-15", "C3-07"],
"branch_types": ["Flagship", "Outlet", "Pop-up"],
"expense_types": ["Travel", "Office Supplies", "Marketing", "Training"]
}'
echo -e "\n\nโœ… Step 2: Testing brands filtering..."
curl -X 'POST' \
'http://127.0.0.1:8000/taxonomy/list' \
-H 'accept: application/json' \
-H "Authorization: Bearer $JWT_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"taxonomy_type": "brands"}' | jq '.'
echo -e "\n\nโœ… Step 3: Testing categories filtering..."
curl -X 'POST' \
'http://127.0.0.1:8000/taxonomy/list' \
-H 'accept: application/json' \
-H "Authorization: Bearer $JWT_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"taxonomy_type": "categories"}' | jq '.'
echo -e "\n\nโœ… Step 4: Testing complete data (no filtering)..."
curl -X 'POST' \
'http://127.0.0.1:8000/taxonomy/list' \
-H 'accept: application/json' \
-H "Authorization: Bearer $JWT_TOKEN" \
-H 'Content-Type: application/json' \
-d '{}' | jq '.data | keys'
echo -e "\n\n๐ŸŽ‰ Test completed!"