Skip to content

chore: fix error in tests #317

chore: fix error in tests

chore: fix error in tests #317

name: Continuous Integration
on: [push]
jobs:
lint_and_test:
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:6379
postgres:
image: postgres
env:
POSTGRES_USER: postgres_user
POSTGRES_PASSWORD: pass123
POSTGRES_DB: ecommerce-test
ports:
- 5432:5432
rabbitmq:
image: rabbitmq
env:
RABBITMQ_DEFAULT_USER: guest
RABBIT_DEFAULT_PASS: guest
ports:
- "5672:5672"
steps:
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Check out repository
uses: actions/checkout@v4
- name: Install Uv
uses: astral-sh/setup-uv@v2
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install dependencies
run: uv sync --all-extras --dev
- name: Lint
run: uv run make lint
- name: Run tests
env:
DYNACONF_DATABASE_URL: "postgresql+psycopg://postgres_user:pass123@localhost/ecommerce-test"
DYNACONF_DATABASE_URI: "postgresql+psycopg://postgres_user:pass123@localhost/ecommerce-test"
FORCE_ENV_FOR_DYNACONF: 'testing'
DYNACONF_FORCE_ENV_FOR_DYNACONF: 'testing'
DYNACONF_REDIS_HOST: "localhost"
DYNACONF_REDIS_PORT: "6379"
DYNACONF_REDIS_DB: 0
DYNACONF_GATEWAY_API: "API_KEY"
DYNACONF_GATEWAY_CRYP: "CRYP_KEY"
DYNACONF_PAYMENT_GATEWAY_URL: "URL_GATEWAY"
DYNACONF_SENDGRID_API_KEY: "API_KEY"
DYNACONF_EMAIL_FROM: "EMAIL"
DYNACONF_API_MAIL_URL: "https://testapi.com/"
DYNACONF_ACCESS_TOKEN_EXPIRE_MINUTES: 15
DYNACONF_STRIPE_SECRET_KEY: "SECRET"
DYNACONF_STRIPE_API_KEY: "API"
DYNACONF_BROKER_URL: "amqp://guest:guest@localhost:5672//"
DYNACONF_RESULT_BACKEND: "rpc://"
run: uv run pytest -s tests/ -x --cov=fast_ecommerce -vv