|
1 | 1 | import os |
| 2 | +from method.resources.Entities.Attributes import EntityAttributes |
2 | 3 | import pytest |
3 | 4 | from method import Method |
4 | 5 | from dotenv import load_dotenv |
|
26 | 27 | entities_account_list_response = None |
27 | 28 | entities_account_ids = None |
28 | 29 | entities_create_credit_score_response = None |
| 30 | +entities_create_attribute_response = None |
29 | 31 | entities_create_idenitity_response = None |
30 | 32 | entities_retrieve_product_list_response = None |
31 | 33 | entities_create_connect_subscription_response = None |
@@ -86,6 +88,7 @@ def test_create_entity(): |
86 | 88 | }, |
87 | 89 | 'connect': None, |
88 | 90 | 'credit_score': None, |
| 91 | + 'attribute': None, |
89 | 92 | 'products': [], |
90 | 93 | 'restricted_products': entities_create_response['restricted_products'], |
91 | 94 | 'subscriptions': [], |
@@ -148,6 +151,7 @@ def test_retrieve_entity(): |
148 | 151 | }, |
149 | 152 | 'connect': None, |
150 | 153 | 'credit_score': None, |
| 154 | + 'attribute': None, |
151 | 155 | 'products': [], |
152 | 156 | 'restricted_products': entities_retrieve_response['restricted_products'], |
153 | 157 | 'subscriptions': [], |
@@ -218,8 +222,9 @@ def test_update_entity(): |
218 | 222 | }, |
219 | 223 | 'connect': None, |
220 | 224 | 'credit_score': None, |
| 225 | + 'attribute': None, |
221 | 226 | 'products': [ 'identity' ], |
222 | | - 'restricted_products': [ 'connect', 'credit_score' ].sort(), |
| 227 | + 'restricted_products': entities_update_response['restricted_products'], |
223 | 228 | 'subscriptions': [], |
224 | 229 | 'available_subscriptions': [], |
225 | 230 | 'restricted_subscriptions': [ 'connect', 'credit_score' ].sort(), |
@@ -378,6 +383,44 @@ def get_credit_score(): |
378 | 383 |
|
379 | 384 | assert credit_score_retrieve_response == expect_results |
380 | 385 |
|
| 386 | +# ENTITY ATTRIBUTE TESTS |
| 387 | + |
| 388 | +def test_create_entity_attribute(): |
| 389 | + global entities_create_attribute_response |
| 390 | + entities_create_attribute_response = method.entities(entities_create_response['id']).attributes.create() |
| 391 | + |
| 392 | + expect_results: EntityAttributes = { |
| 393 | + 'id': entities_create_attribute_response['id'], |
| 394 | + 'entity_id': entities_create_response['id'], |
| 395 | + 'status': 'completed', |
| 396 | + 'attributes': entities_create_attribute_response.attributes, |
| 397 | + 'error': None, |
| 398 | + 'created_at': entities_create_attribute_response['created_at'], |
| 399 | + 'updated_at': entities_create_attribute_response['updated_at'] |
| 400 | + } |
| 401 | + |
| 402 | + assert entities_create_attribute_response == expect_results |
| 403 | + |
| 404 | +@pytest.mark.asyncio |
| 405 | +async def test_retrieve_entity_attribute(): |
| 406 | + def get_attribute(): |
| 407 | + return method.entities(entities_create_response['id']).attributes.retrieve(entities_create_attribute_response['id']) |
| 408 | + |
| 409 | + attribute_retrieve_response = await await_results(get_attribute) |
| 410 | + |
| 411 | + expect_results: EntityAttributes = { |
| 412 | + 'id': attribute_retrieve_response['id'], |
| 413 | + 'entity_id': entities_create_response['id'], |
| 414 | + 'status': 'completed', |
| 415 | + 'attributes': attribute_retrieve_response.attributes, |
| 416 | + 'error': None, |
| 417 | + 'created_at': attribute_retrieve_response['created_at'], |
| 418 | + 'updated_at': attribute_retrieve_response['updated_at'] |
| 419 | + } |
| 420 | + |
| 421 | + assert attribute_retrieve_response == expect_results |
| 422 | + |
| 423 | + |
381 | 424 | # ENTITY IDENTITY TESTS |
382 | 425 |
|
383 | 426 | def test_create_entity_identity(): |
@@ -517,6 +560,16 @@ def test_retrieve_entity_product_list(): |
517 | 560 | 'is_subscribable': False, |
518 | 561 | 'created_at': entities_retrieve_product_list_response.get('identity', {}).get('created_at', ''), |
519 | 562 | 'updated_at': entities_retrieve_product_list_response.get('identity', {}).get('updated_at', ''), |
| 563 | + }, |
| 564 | + 'attribute': { |
| 565 | + 'id': entities_retrieve_product_list_response.get('attribute', {}).get('id', ''), |
| 566 | + 'name': 'attribute', |
| 567 | + 'status': 'available', |
| 568 | + 'status_error': None, |
| 569 | + 'latest_request_id': entities_retrieve_product_list_response.get('attribute', {}).get('latest_request_id', None), |
| 570 | + 'is_subscribable': False, |
| 571 | + 'created_at': entities_retrieve_product_list_response.get('attribute', {}).get('created_at', ''), |
| 572 | + 'updated_at': entities_retrieve_product_list_response.get('attribute', {}).get('updated_at', ''), |
520 | 573 | } |
521 | 574 | } |
522 | 575 |
|
@@ -554,6 +607,17 @@ def test_retrieve_entity_product(): |
554 | 607 | 'updated_at': entity_credit_score_product_response['updated_at'] |
555 | 608 | } |
556 | 609 |
|
| 610 | + expect_attribute_results: EntityProduct = { |
| 611 | + 'id': entities_retrieve_product_list_response.get('attribute', {}).get('id', ''), |
| 612 | + 'name': 'attribute', |
| 613 | + 'status': 'available', |
| 614 | + 'status_error': None, |
| 615 | + 'latest_request_id': entities_retrieve_product_list_response.get('attribute', {}).get('latest_request_id', None), |
| 616 | + 'is_subscribable': False, |
| 617 | + 'created_at': entities_retrieve_product_list_response.get('attribute', {}).get('created_at', ''), |
| 618 | + 'updated_at': entities_retrieve_product_list_response.get('attribute', {}).get('updated_at', ''), |
| 619 | + } |
| 620 | + |
557 | 621 | expect_identity_results: EntityProduct = { |
558 | 622 | 'id': entity_identity_product_id, |
559 | 623 | 'name': 'identity', |
|
0 commit comments