BTHLABS-58: Share Extension in Apple Apps

This commit is contained in:
2025-10-04 08:02:13 +02:00
parent 0c12f52569
commit 99e9226338
122 changed files with 5488 additions and 411 deletions

View File

@@ -1,3 +1,4 @@
from .access_token import * # noqa: F401,F403
from .account import * # noqa: F401,F403
from .apps import * # noqa: F401,F403
from .auth_key import * # noqa: F401,F403

View File

@@ -0,0 +1,109 @@
# -*- coding: utf-8 -*-
# type: ignore
from __future__ import annotations
import datetime
from django.utils.timezone import get_current_timezone, now
import pytest
from hotpocket_soa.dto.accounts import AuthKeyOut
@pytest.fixture
def auth_key_factory(request: pytest.FixtureRequest):
default_account = request.getfixturevalue('account')
def factory(account=None, **kwargs):
from hotpocket_backend_testing.factories.accounts import AuthKeyFactory
return AuthKeyFactory(
account_uuid=(
account.pk
if account is not None
else default_account.pk
),
**kwargs,
)
return factory
@pytest.fixture
def auth_key(auth_key_factory):
return auth_key_factory()
@pytest.fixture
def auth_key_out(auth_key):
return AuthKeyOut.model_validate(auth_key, from_attributes=True)
@pytest.fixture
def deleted_auth_key(auth_key_factory):
return auth_key_factory(deleted_at=now())
@pytest.fixture
def deleted_auth_key_out(deleted_auth_key):
return AuthKeyOut.model_validate(deleted_auth_key, from_attributes=True)
@pytest.fixture
def expired_auth_key(auth_key_factory):
result = auth_key_factory()
result.created_at = datetime.datetime(
1987, 10, 3, 8, 0, 0, tzinfo=get_current_timezone(),
)
result.save()
return result
@pytest.fixture
def expired_auth_key_out(expired_auth_key):
return AuthKeyOut.model_validate(expired_auth_key, from_attributes=True)
@pytest.fixture
def consumed_auth_key(auth_key_factory):
return auth_key_factory(consumed_at=now())
@pytest.fixture
def consumed_auth_key_out(consumed_auth_key):
return AuthKeyOut.model_validate(consumed_auth_key, from_attributes=True)
@pytest.fixture
def other_auth_key(auth_key_factory):
return auth_key_factory()
@pytest.fixture
def other_auth_key_out(other_auth_key):
return AuthKeyOut.model_validate(other_auth_key, from_attributes=True)
@pytest.fixture
def inactive_account_auth_key(auth_key_factory, inactive_account):
return auth_key_factory(account=inactive_account)
@pytest.fixture
def inactive_account_auth_key_out(auth_key):
return AuthKeyOut.model_validate(
inactive_account_auth_key, from_attributes=True,
)
@pytest.fixture
def other_account_auth_key(auth_key_factory, other_account):
return auth_key_factory(account=other_account)
@pytest.fixture
def other_account_auth_key_out(other_account_auth_key):
return AuthKeyOut.model_validate(
other_account_auth_key, from_attributes=True,
)