Spaces:
Runtime error
Runtime error
Greg
Claude Opus 4.7 (1M context)
Preparar despliegue en fly.io: monolito dockerizado + seeder demo
6aa6081 Download tests/conftest.py from Talosware/talos-access: direct link, hf CLI and curl.
- Browser
- Download file 2.8 kB
-
https://huggingface.co/spaces/Talosware/talos-access/resolve/main/tests/conftest.py
- Command line
-
hf download hf://spaces/Talosware/talos-access/tests/conftest.py
-
curl -L -o conftest.py https://huggingface.co/spaces/Talosware/talos-access/resolve/main/tests/conftest.py
2.8 kB
| import pytest | |
| from datetime import date | |
| from sqlalchemy import create_engine, Column, BigInteger, String, Date, DateTime, Integer | |
| from sqlalchemy.orm import sessionmaker | |
| from sqlalchemy.orm import declarative_base | |
| TestBase = declarative_base() | |
| class User(TestBase): | |
| __tablename__ = "users" | |
| id = Column(Integer, primary_key=True, autoincrement=True) | |
| account_id = Column(BigInteger, nullable=False, default=1) | |
| name = Column(String(100), nullable=False) | |
| lastname = Column(String(100), nullable=False) | |
| card_id = Column(String(50), unique=True) | |
| email = Column(String(150), unique=True) | |
| role = Column(String(20), nullable=False) | |
| is_active = Column(String(1), default="1") | |
| class Section(TestBase): | |
| __tablename__ = "sections" | |
| id = Column(Integer, primary_key=True, autoincrement=True) | |
| account_id = Column(BigInteger, nullable=False, default=1) | |
| name = Column(String(150), nullable=False) | |
| max_students = Column(Integer, default=40) | |
| class Enrollment(TestBase): | |
| __tablename__ = "enrollments" | |
| id = Column(Integer, primary_key=True, autoincrement=True) | |
| section_id = Column(BigInteger, nullable=False) | |
| student_id = Column(BigInteger, nullable=False) | |
| account_id = Column(BigInteger, nullable=False) | |
| class Attendance(TestBase): | |
| __tablename__ = "attendances" | |
| id = Column(Integer, primary_key=True, autoincrement=True) | |
| account_id = Column(BigInteger, nullable=False, default=1) | |
| user_id = Column(BigInteger, nullable=False) | |
| action = Column(String(10)) | |
| checkout_time = Column(DateTime(timezone=True), nullable=True) | |
| note = Column(String(255)) | |
| class Holiday(TestBase): | |
| __tablename__ = "holidays" | |
| id = Column(Integer, primary_key=True, autoincrement=True) | |
| account_id = Column(BigInteger, nullable=False, default=1) | |
| name = Column(String(255), nullable=False) | |
| date = Column(Date, nullable=False) | |
| type = Column(String(20), nullable=False) | |
| def db(): | |
| engine = create_engine("sqlite:///:memory:", echo=False) | |
| TestBase.metadata.create_all(engine) | |
| TestingSession = sessionmaker(bind=engine) | |
| session = TestingSession() | |
| yield session | |
| session.close() | |
| def section(db): | |
| s = Section(name="1ro A", max_students=2) | |
| db.add(s) | |
| db.commit() | |
| db.refresh(s) | |
| return s | |
| def students(db): | |
| result = [] | |
| for i in range(3): | |
| s = User(name=f"S{i+1}", lastname="T", card_id=f"C{i+1}", role="student", email=f"s{i+1}@t.com") | |
| db.add(s) | |
| db.flush() | |
| result.append(s) | |
| db.commit() | |
| return result | |
| def holiday(db): | |
| h = Holiday(name="Test", date=date.today(), type="national") | |
| db.add(h) | |
| db.commit() | |
| db.refresh(h) | |
| return h | |