cic-internal-integration/apps/cic-ussd/tests/fixtures/metadata.py

40 lines
1.3 KiB
Python
Raw Permalink Normal View History

2021-08-06 18:29:01 +02:00
# standard imports
import logging
import os
import tempfile
# external imports
import pytest
from chainlib.hash import strip_0x
2021-10-15 13:21:41 +02:00
from cic_types.condiments import MetadataPointer
2021-08-06 18:29:01 +02:00
from cic_types.processor import generate_metadata_pointer
# local imports
2021-10-15 13:21:41 +02:00
from cic_ussd.metadata import PersonMetadata, PhonePointerMetadata, PreferencesMetadata
2021-08-06 18:29:01 +02:00
logg = logging.getLogger(__name__)
@pytest.fixture(scope='function')
def account_phone_pointer(activated_account):
identifier = bytes.fromhex(strip_0x(activated_account.blockchain_address))
2021-10-15 13:21:41 +02:00
return generate_metadata_pointer(identifier, MetadataPointer.PERSON)
2021-08-06 18:29:01 +02:00
@pytest.fixture(scope='function')
def person_metadata_url(activated_account, setup_metadata_request_handler):
identifier = bytes.fromhex(strip_0x(activated_account.blockchain_address))
return PersonMetadata(identifier).url
@pytest.fixture(scope='function')
def phone_pointer_url(activated_account, setup_metadata_request_handler):
identifier = bytes.fromhex(strip_0x(activated_account.blockchain_address))
return PhonePointerMetadata(identifier).url
@pytest.fixture(scope='function')
def preferences_metadata_url(activated_account, setup_metadata_request_handler):
identifier = bytes.fromhex(strip_0x(activated_account.blockchain_address))
return PreferencesMetadata(identifier).url