~homeworkprod/byceps

a3214d27456b4060727966ca1ad520a92edaa6b2 — Jochen Kupperschmidt 3 years ago 3f0e201
Make tourney avatar path depend on party path, but non-configurable besides that
M byceps/services/tourney/avatar/models.py => byceps/services/tourney/avatar/models.py +1 -1
@@ 59,7 59,7 @@ class Avatar(db.Model):

    @property
    def path(self) -> Path:
        path = current_app.config['PATH_TOURNEY_AVATAR_IMAGES']
        path = current_app.config['PATH_PARTY'] / 'tourney' / 'avatars'
        return path / self.filename

    @property

M config/development_party.py => config/development_party.py +0 -1
@@ 21,7 21,6 @@ PATH_GLOBAL = PATH_DATA / 'global'
PATH_BRAND = PATH_DATA / 'brands' / BRAND
PATH_PARTY = PATH_DATA / 'parties' / PARTY
PATH_USER_AVATAR_IMAGES = PATH_GLOBAL / 'users/avatars'
PATH_TOURNEY_AVATAR_IMAGES = PATH_PARTY / 'tourney/avatars'

MAIL_DEBUG = True
MAIL_DEFAULT_SENDER = 'BYCEPS <noreply@example.com>'

M config/production_party.py => config/production_party.py +0 -1
@@ 28,7 28,6 @@ PATH_GLOBAL = PATH_DATA / 'global'
PATH_BRAND = PATH_DATA / 'brands' / BRAND
PATH_PARTY = PATH_DATA / 'parties' / PARTY
PATH_USER_AVATAR_IMAGES = PATH_GLOBAL / 'users/avatars'
PATH_TOURNEY_AVATAR_IMAGES = PATH_PARTY / 'tourney/avatars'

MAIL_DEBUG = False
MAIL_DEFAULT_SENDER = 'BYCEPS <noreply@example.com>'

M tests/api/tourney/avatar/test_create.py => tests/api/tourney/avatar/test_create.py +3 -3
@@ 10,9 10,9 @@ import pytest


def test_create(
    tourney_path, app, api_client, api_client_authz_header, party, user
    party_path, app, api_client, api_client_authz_header, party, user
):
    app.config['PATH_TOURNEY_AVATAR_IMAGES'] = tourney_path / 'avatars'
    app.config['PATH_PARTY'] = party_path

    response = send_request(
        api_client, api_client_authz_header, party.id, user.id


@@ 22,7 22,7 @@ def test_create(


@pytest.fixture
def tourney_path():
def party_path():
    with TemporaryDirectory() as d:
        yield Path(d)