"""Tests for KYC notification schemas.""" from payee.schemas.payee_kyc_notification import ( AccountPayeeKycNotificationOutputSchema, AccountPayeeKycNotificationSchema, PayeeKycNotificationDataloaderOutputSchema, PayeeKycNotificationOutputSchema, PayeeKycNotificationSchema, ) from tests.utils.common import convert_object_to_dict from tests.utils.factories import ( AccountPayeeKycNotificationFactory, PayeeKycNotificationFactory, ) def test_account_payee_kyc_notification_output_schema(): """Test AccountPayeeKycNotificationOutputSchema schema.""" kyc_notification = AccountPayeeKycNotificationFactory.build() result = AccountPayeeKycNotificationOutputSchema().dump(kyc_notification) assert result == convert_object_to_dict( kyc_notification, remove_fields=('deleted_at', 'deleted_by') ) def test_account_payee_kyc_notification_schema(): """Test AccountPayeeKycNotificationSchema schema.""" kyc_notification = convert_object_to_dict( AccountPayeeKycNotificationFactory.build(), remove_fields=( 'account_payee_kyc_notification_id', 'account_payee_id', 'created_at', 'last_modified', 'created_by', 'last_modified_by', 'deleted_at', 'deleted_by', ), ) result = AccountPayeeKycNotificationSchema().load(kyc_notification) assert result == kyc_notification def test_payee_kyc_notification_output_schema(): """Test PayeeKycNotificationOutputSchema schema.""" kyc_notification = PayeeKycNotificationFactory.build() result = PayeeKycNotificationOutputSchema().dump(kyc_notification) assert result == convert_object_to_dict( kyc_notification, remove_fields=('deleted_at', 'deleted_by') ) def test_payee_kyc_notification_schema(): """Test PayeeKycNotificationSchema schema.""" kyc_notification = convert_object_to_dict( PayeeKycNotificationFactory.build(), remove_fields=( 'payee_kyc_notification_id', 'payee_id', 'created_at', 'last_modified', 'created_by', 'last_modified_by', 'deleted_at', 'deleted_by', ), ) result = PayeeKycNotificationSchema().load(kyc_notification) assert result == kyc_notification def test_payee_kyc_notification_dataloader_output_schema(): """Test PayeeKycNotificationDataloaderOutputSchema schema.""" assert {} == PayeeKycNotificationDataloaderOutputSchema().validate( { 'payee_kyc_notifications': [ { 'data': PayeeKycNotificationOutputSchema().dump( PayeeKycNotificationFactory.build() ) }, ] } )