chore: Remove unused test files for debug and user info
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
import sys
|
||||
import os
|
||||
sys.path.append('/app')
|
||||
sys.path.append('/home/josmar/dev/anexo76/backend')
|
||||
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
# Disable logging to keep output clean
|
||||
logging.basicConfig(level=logging.ERROR)
|
||||
|
||||
from api.v1.modules.a76.general_catalogs.fractions.tariff_fractions.service import TariffFractionService
|
||||
from api.v1.modules.a76.general_catalogs.fractions.tariff_fractions.dto import TariffFractionResponseDTO
|
||||
|
||||
async def test():
|
||||
# Use the database URL from the environment or default
|
||||
db_url = "postgresql://postgres:postgres@anexo76-postgres-a76:5432/anexo76_core"
|
||||
engine = create_engine(db_url)
|
||||
Session = sessionmaker(bind=engine)
|
||||
db = Session()
|
||||
|
||||
try:
|
||||
print("Starting test for catalog='american'...")
|
||||
items, total = await TariffFractionService.get_all(
|
||||
db, skip=0, limit=10, filters=None, catalog="american", tenant_id=1, company_id=1
|
||||
)
|
||||
print(f"Service Success! Total: {total}")
|
||||
|
||||
print("Validating items with TariffFractionResponseDTO...")
|
||||
for item in items:
|
||||
dto = TariffFractionResponseDTO.model_validate(item)
|
||||
print(f"DTO: ID={dto.id}, Code={dto.code}, Fraction={dto.fraction}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error caught: {type(e).__name__}: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(test())
|
||||
@@ -1,39 +0,0 @@
|
||||
import sys
|
||||
import os
|
||||
sys.path.append('/app')
|
||||
sys.path.append('/home/josmar/dev/anexo76/backend')
|
||||
|
||||
from sqlalchemy import create_engine, text
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
def test():
|
||||
db_url = "postgresql://postgres:postgres@anexo76-postgres-a76:5432/anexo76_core"
|
||||
engine = create_engine(db_url)
|
||||
Session = sessionmaker(bind=engine)
|
||||
db = Session()
|
||||
|
||||
try:
|
||||
print("Checking users and tenants...")
|
||||
# Check users
|
||||
users = db.execute(text("SELECT id, email, tenant_id FROM a76.users")).fetchall()
|
||||
for u in users:
|
||||
print(f"User ID: {u.id} | Email: {u.email} | Tenant ID: {u.tenant_id}")
|
||||
|
||||
# Check companies
|
||||
companies = db.execute(text("SELECT id, name, tenant_id FROM a76.companies")).fetchall()
|
||||
for c in companies:
|
||||
print(f"Company ID: {c.id} | Name: {c.name} | Tenant ID: {c.tenant_id}")
|
||||
|
||||
# Check fractions
|
||||
fractions = db.execute(text("SELECT id, code, tenant_id, company_id FROM a76.us_tariff_fractions")).fetchall()
|
||||
print(f"Total US Fractions in DB: {len(fractions)}")
|
||||
for f in fractions:
|
||||
print(f"Fraction ID: {f.id} | Code: {f.code} | Tenant ID: {f.tenant_id} | Company ID: {f.company_id}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
test()
|
||||
Reference in New Issue
Block a user