Skip to content

Commit

Permalink
Merge branch 'main' into remove-error-when-tour-router-change
Browse files Browse the repository at this point in the history
  • Loading branch information
MitanOmar authored May 23, 2024
2 parents c1608e4 + 419f74c commit 830e825
Show file tree
Hide file tree
Showing 65 changed files with 2,668 additions and 2,084 deletions.
4 changes: 1 addition & 3 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
backend/ @adfinis/dev-backend
frontend/ @adfinis/dev-frontend
frontend/pnpm-lock.yaml @adfinis/dev-timed
frontend/package.json @adfinis/dev-timed
frontend/ @adfinis/dev-timed
charts/ @adfinis/dev-devops
6 changes: 3 additions & 3 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11-alpine AS base
FROM python:3.12-alpine AS base

RUN apk update --no-cache && apk upgrade --no-cache && apk add shadow --no-cache && useradd -m -r -u 1001 timed && apk del shadow && rm -rf /var/cache/apk/*

Expand Down Expand Up @@ -41,9 +41,9 @@ FROM build as dev
WORKDIR /app

RUN apk update --no-cache && \
apk add gcc python3-dev musl-dev linux-headers wait4ports && \
apk add gcc python3-dev musl-dev libffi-dev linux-headers wait4ports && \
poetry config virtualenvs.create false && poetry install && \
apk del gcc python3-dev musl-dev linux-headers --no-cache && \
apk del gcc python3-dev musl-dev libffi-dev linux-headers --no-cache && \
chmod 777 /var/www/static

USER 1001
Expand Down
100 changes: 0 additions & 100 deletions backend/compose.yaml

This file was deleted.

49 changes: 32 additions & 17 deletions backend/timed/conftest.py → backend/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from __future__ import annotations

import inspect
from typing import TYPE_CHECKING

import pytest
from django.contrib.auth import get_user_model
Expand All @@ -12,6 +15,9 @@
from timed.subscription import factories as subscription_factories
from timed.tracking import factories as tracking_factories

if TYPE_CHECKING:
from timed.employment.models import CustomerAssignee, Employment, User


def register_module(module):
for _name, obj in inspect.getmembers(module):
Expand Down Expand Up @@ -145,22 +151,31 @@ def _autoclear_cache():
cache.clear()


@pytest.fixture
def setup_customer_and_employment_status(
user, is_assignee, is_customer, is_employed, is_external
db, # noqa: ARG001
customer_assignee_factory,
employment_factory,
):
"""Set up customer and employment status.
Return a 2-tuple of assignee and employment, if they
were created
"""
assignee = None
employment = None
if is_assignee:
assignee = projects_factories.CustomerAssigneeFactory.create(
user=user, is_customer=is_customer
)
if is_employed:
employment = employment_factories.EmploymentFactory.create(
user=user, is_external=is_external
)
return assignee, employment
def _setup_customer_and_employment_status(
user: User,
*,
is_assignee: bool,
is_customer: bool,
is_employed: bool,
is_external: bool,
) -> tuple[CustomerAssignee | None, Employment | None]:
"""Set up customer and employment status.
Return a 2-tuple of assignee and employment, if they
were created
"""
assignee = None
employment = None
if is_assignee:
assignee = customer_assignee_factory(user=user, is_customer=is_customer)
if is_employed:
employment = employment_factory(user=user, is_external=is_external)
return assignee, employment

return _setup_customer_and_employment_status
Loading

0 comments on commit 830e825

Please sign in to comment.