|
7 | 7 |
|
8 | 8 | from yoti_python_sdk import config
|
9 | 9 | from yoti_python_sdk.attribute import Attribute
|
10 |
| -from yoti_python_sdk.profile import Profile |
| 10 | +from yoti_python_sdk.profile import Profile, ApplicationProfile |
11 | 11 | from yoti_python_sdk.protobuf.protobuf import Protobuf
|
12 | 12 | from yoti_python_sdk.tests import attribute_fixture_parser, image_helper
|
13 | 13 | from yoti_python_sdk.tests.protobuf_attribute import ProtobufAttribute
|
| 14 | +from yoti_python_sdk.image import Image |
14 | 15 |
|
15 | 16 | ADDRESS_FORMAT_KEY = "address_format"
|
16 | 17 | ADDRESS_FORMAT_VALUE = 1
|
@@ -92,6 +93,15 @@ def create_attribute_list_with_selfie_field():
|
92 | 93 | )
|
93 | 94 |
|
94 | 95 |
|
| 96 | +def create_attribute_list_with_application_logo(): |
| 97 | + return create_single_attribute_list( |
| 98 | + name=config.ATTRIBUTE_APPLICATION_LOGO, |
| 99 | + value="base64(┛ಠ_ಠ)┛彡┻━┻", |
| 100 | + anchors=None, |
| 101 | + content_type=Protobuf.CT_JPEG, |
| 102 | + ) |
| 103 | + |
| 104 | + |
95 | 105 | def create_attribute_list_with_email_field():
|
96 | 106 | return create_single_attribute_list(
|
97 | 107 | name=config.ATTRIBUTE_EMAIL_ADDRESS,
|
@@ -587,3 +597,58 @@ def test_get_document_details_india():
|
587 | 597 | assert document.issuing_country == INDIA_COUNTRY_ISO_VALUE
|
588 | 598 | assert document.document_number == IND_DRIVING_LICENCE_NUMBER
|
589 | 599 | assert document.expiration_date.isoformat() == EXPIRY_DATE
|
| 600 | + |
| 601 | + |
| 602 | +def test_create_application_profile_with_name(): |
| 603 | + attribute_list = create_single_attribute_list( |
| 604 | + name=config.ATTRIBUTE_APPLICATION_NAME, |
| 605 | + value="yoti-sdk-test", |
| 606 | + anchors=None, |
| 607 | + content_type=Protobuf.CT_STRING |
| 608 | + ) |
| 609 | + |
| 610 | + app_profile = ApplicationProfile(attribute_list) |
| 611 | + |
| 612 | + assert (app_profile.get_attribute(config.ATTRIBUTE_APPLICATION_NAME) == app_profile.application_name) |
| 613 | + assert isinstance(app_profile, ApplicationProfile) |
| 614 | + |
| 615 | + |
| 616 | +def test_create_application_profile_with_url(): |
| 617 | + attribute_list = create_single_attribute_list( |
| 618 | + name=config.ATTRIBUTE_APPLICATION_URL, |
| 619 | + value="https://yoti.com", |
| 620 | + anchors=None, |
| 621 | + content_type=Protobuf.CT_STRING |
| 622 | + ) |
| 623 | + |
| 624 | + app_profile = ApplicationProfile(attribute_list) |
| 625 | + |
| 626 | + assert (app_profile.get_attribute(config.ATTRIBUTE_APPLICATION_URL) == app_profile.application_url) |
| 627 | + assert isinstance(app_profile, ApplicationProfile) |
| 628 | + |
| 629 | + |
| 630 | +def test_create_application_profile_with_receipt_bgcolor(): |
| 631 | + attribute_list = create_single_attribute_list( |
| 632 | + name=config.ATTRIBUTE_APPLICATION_RECEIPT_BGCOLOR, |
| 633 | + value="#FFFFFF", |
| 634 | + anchors=None, |
| 635 | + content_type=Protobuf.CT_STRING |
| 636 | + ) |
| 637 | + |
| 638 | + app_profile = ApplicationProfile(attribute_list) |
| 639 | + |
| 640 | + assert (app_profile.get_attribute(config.ATTRIBUTE_APPLICATION_RECEIPT_BGCOLOR) == app_profile.application_receipt_bg_color) |
| 641 | + assert isinstance(app_profile, ApplicationProfile) |
| 642 | + |
| 643 | + |
| 644 | +def test_create_application_profile_with_logo(): |
| 645 | + attribute_list = create_attribute_list_with_application_logo() |
| 646 | + |
| 647 | + app_profile = ApplicationProfile(attribute_list) |
| 648 | + app_logo = app_profile.application_logo |
| 649 | + |
| 650 | + assert isinstance(app_logo.value, Image) |
| 651 | + assert (app_profile.get_attribute(config.ATTRIBUTE_APPLICATION_LOGO) == app_profile.application_logo) |
| 652 | + assert isinstance(app_profile, ApplicationProfile) |
| 653 | + |
| 654 | + |
0 commit comments