def test_transaction_record_result(self):
     transaction_record_result = TransactionRecordResult(
         transaction_id="test-guid",
         uploaded_dt=datetime(2020, 9, 15),
         country_code="AU",
         product_name="IDV",
         record=Record(record_status="nomatch"),
         customer_reference_id="ref-123",
         errors=[ServiceError(message="test")],
         input_fields=[DataField(field_name="field")],
     )
Beispiel #2
0
    def test_get_transaction_record(self):
        mock = pook.mock(
            url=BASE_URI +
            "/trial/verifications/v1/transactionrecord/test-transaction-guid",
            method="GET",
            headers={"x-trulioo-api-key": "test-api-key"},
            reply=200,
            response_json={
                "InputFields": [{
                    "FieldName": "FirstName",
                    "Value": "Test"
                }],
                "UploadedDt": "2017-07-11T21:47:50",
                "Record": {
                    "TransactionRecordID":
                    "test-transaction-guid",
                    "RecordStatus":
                    "match",
                    "DatasourceResults": [{
                        "DatasourceName":
                        "Datasource",
                        "DatasourceFields": [{
                            "FieldName": "FirstName",
                            "Status": "match"
                        }],
                    }],
                },
                "Errors": [],
            },
        )
        result = self.api.get_transaction_record(mode="trial",
                                                 id="test-transaction-guid")

        assert mock.calls == 1
        assert result == TransactionRecordResult(
            input_fields=[DataField(field_name="FirstName", value="Test")],
            uploaded_dt=datetime.fromisoformat("2017-07-11T21:47:50"),
            record=Record(
                transaction_record_id="test-transaction-guid",
                record_status="match",
                datasource_results=[
                    DatasourceResult(
                        datasource_name="Datasource",
                        datasource_fields=[
                            DatasourceField(field_name="FirstName",
                                            status="match")
                        ],
                    )
                ],
            ),
            errors=[],
        )
Beispiel #3
0
 def test_transactionrecordresultallof(self):
     transactionrecordresultallof = TransactionRecordResultAllOf(
         input_fields=[DataField(field_name="field", value="test")]
     )
Beispiel #4
0
 def test_data_field(self):
     data_field = DataField(field_name="field",
                            value="value",
                            field_group="field_group")
Beispiel #5
0
 def test_data_field_discard_kwarg(self):
     data_field = DataField(
         _configuration=Configuration(discard_unknown_keys=True),
         abc="unknown")
     with self.assertRaises(ApiAttributeError):
         data_field.abc
Beispiel #6
0
 def test_data_field_unknown_arg(self):
     with self.assertRaises(ApiTypeError):
         data_field = DataField("test")