cic-stack/apps/cic-ussd/tests/cic_ussd/metadata/test_phone.py

24 lines
920 B
Python
Raw Normal View History

2021-08-06 18:29:01 +02:00
# standard imports
import os
# external imports
from chainlib.hash import strip_0x
from cic_types.processor import generate_metadata_pointer
# local imports
from cic_ussd.metadata import PhonePointerMetadata
# test imports
def test_phone_pointer_metadata(activated_account, load_config, setup_metadata_request_handler, setup_metadata_signer):
cic_type = ':cic.phone'
identifier = bytes.fromhex(strip_0x(activated_account.blockchain_address))
phone_pointer_metadata = PhonePointerMetadata(identifier)
assert phone_pointer_metadata.cic_type == cic_type
assert phone_pointer_metadata.engine == 'pgp'
assert phone_pointer_metadata.identifier == identifier
assert phone_pointer_metadata.metadata_pointer == generate_metadata_pointer(identifier, cic_type)
assert phone_pointer_metadata.url == os.path.join(
load_config.get('CIC_META_URL'), phone_pointer_metadata.metadata_pointer)