- create `*Factory` classes with fakerboy and faker that generate randomized instances of the ORM models - add new pytest marker: "db" are the integration tests involving the database whereas "e2e" will be all other integration tests - streamline the docstrings in the ORM models
24 lines
617 B
Python
24 lines
617 B
Python
"""Provide the ORM's `Customer` model."""
|
|
|
|
import sqlalchemy as sa
|
|
from sqlalchemy import orm
|
|
|
|
from urban_meal_delivery.db import meta
|
|
|
|
|
|
class Customer(meta.Base):
|
|
"""A customer of the UDP."""
|
|
|
|
__tablename__ = 'customers'
|
|
|
|
# Columns
|
|
id = sa.Column(sa.Integer, primary_key=True, autoincrement=False) # noqa:WPS125
|
|
|
|
def __repr__(self) -> str:
|
|
"""Non-literal text representation."""
|
|
return '<{cls}(#{customer_id})>'.format(
|
|
cls=self.__class__.__name__, customer_id=self.id,
|
|
)
|
|
|
|
# Relationships
|
|
orders = orm.relationship('Order', back_populates='customer')
|