1
0
mirror of synced 2025-12-21 02:51:29 -05:00
Files
airbyte/airbyte-integrations/connectors/source-zoho-crm/unit_tests/parametrize.py
Dhroov Makwana 5cfdd55a4b 🚨Source Zoho CRM: Migrate to poetry (#42864)
Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
Co-authored-by: Natik Gadzhi <natik@respawn.io>
2025-02-05 10:09:08 -08:00

269 lines
7.7 KiB
Python

#
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
#
from collections import namedtuple
import pytest
TestCase = namedtuple(
"TestCase", ("json_type", "data_type", "length", "decimal_place", "api_name", "pick_list_values", "autonumber", "expected_values")
)
datatype_inputs = pytest.mark.parametrize(
TestCase._fields,
(
TestCase("boolean", "boolean", None, None, "Field", [], None, {"title": "Field", "type": ["null", "boolean"]}),
TestCase("double", "double", None, 3, "Field", [], None, {"multipleOf": 0.001, "title": "Field", "type": ["null", "number"]}),
TestCase("double", "currency", None, 2, "Field", [], None, {"multipleOf": 0.01, "title": "Field", "type": ["null", "number"]}),
TestCase("integer", "integer", None, None, "Field", [], None, {"title": "Field", "type": ["null", "integer"]}),
TestCase("string", "profileimage", 256, None, "Field", [], None, {"maxLength": 256, "title": "Field", "type": ["null", "string"]}),
TestCase(
"string",
"picklist",
128,
None,
"Field",
["Chelsea", "Arsenal", "ManUtd"],
None,
{"enum": [None, "Chelsea", "Arsenal", "ManUtd"], "maxLength": 128, "title": "Field", "type": ["null", "string"]},
),
TestCase("string", "textarea", 1024, None, "Field", [], None, {"maxLength": 1024, "title": "Field", "type": ["null", "string"]}),
TestCase(
"string",
"website",
256,
None,
"Field",
[],
None,
{
"format": "uri",
"maxLength": 256,
"title": "Field",
"type": ["null", "string"],
},
),
TestCase(
"string",
"date",
16,
None,
"Field",
[],
None,
{
"format": "date",
"maxLength": 16,
"title": "Field",
"type": ["null", "string"],
},
),
TestCase(
"string",
"datetime",
32,
None,
"Field",
[],
None,
{
"format": "date-time",
"maxLength": 32,
"title": "Field",
"type": ["null", "string"],
},
),
TestCase("string", "text", 1024, None, "Field", [], None, {"maxLength": 1024, "title": "Field", "type": ["null", "string"]}),
TestCase("string", "phone", 16, None, "Field", [], None, {"maxLength": 16, "title": "Field", "type": ["null", "string"]}),
TestCase(
"string",
"bigint",
None,
None,
"Field",
[],
None,
{
"airbyte_type": "big_integer",
"maxLength": None,
"title": "Field",
"type": ["null", "string"],
},
),
TestCase(
"string",
"event_reminder",
None,
None,
"Reminder",
["15 min", "30 min", "1 hour"],
None,
{"format": "date-time", "title": "Reminder", "type": ["null", "string"]},
),
TestCase(
"string",
"email",
256,
None,
"Field",
[],
None,
{
"format": "email",
"maxLength": 256,
"title": "Field",
"type": ["null", "string"],
},
),
TestCase(
"jsonobject",
"ownerlookup",
None,
None,
"Field",
[],
None,
{
"additionalProperties": True,
"properties": {
"email": {"format": "email", "type": "string"},
"id": {"type": "string"},
"name": {"type": ["null", "string"]},
},
"required": ["name", "id", "email"],
"title": "Field",
"type": ["null", "object"],
},
),
TestCase("jsonobject", "RRULE", None, None, "Field", [], None, {"type": ["null", "object"]}),
TestCase("jsonobject", "ALARM", None, None, "Field", [], None, {"type": ["null", "object"]}),
TestCase(
"jsonobject",
"lookup",
None,
None,
"Field",
[],
None,
{
"additionalProperties": True,
"properties": {"id": {"type": "string"}, "name": {"type": ["null", "string"]}},
"required": ["name", "id"],
"title": "Field",
"type": ["null", "object"],
},
),
TestCase(
"jsonarray",
"bigint",
1024,
None,
"Field",
[],
None,
{"items": {"airbyte_type": "big_integer", "type": "string"}, "title": "Field", "type": "array"},
),
TestCase(
"jsonarray",
"text",
2056,
None,
"Field",
[],
None,
{"items": {"airbyte_type": "big_integer", "type": "string"}, "title": "Field", "type": "array"},
),
TestCase(
"jsonarray",
"text",
2056,
None,
"Pricing_Details",
[],
None,
{"items": {"type": "object"}, "title": "Pricing_Details", "type": "array"},
),
TestCase(
"jsonarray",
"text",
2056,
None,
"Product_Details",
[],
None,
{"items": {"type": "object"}, "title": "Product_Details", "type": "array"},
),
TestCase(
"jsonarray",
"string",
None,
None,
"Tag",
[],
None,
{
"items": {
"additionalProperties": True,
"properties": {"id": {"type": "string"}, "name": {"type": "string"}},
"required": ["name", "id"],
"type": "object",
},
"title": "Tag",
"type": "array",
},
),
TestCase(
"jsonarray",
"multiselectpicklist",
128,
None,
"Field",
["A", "B", "C", "D"],
None,
{
"items": {"enum": [None, "A", "B", "C", "D"], "type": ["null", "string"]},
"minItems": 1,
"title": "Field",
"type": "array",
"uniqueItems": True,
},
),
TestCase(
"string",
"autonumber",
512,
None,
"Field",
[],
{
"prefix": "prefix",
"suffix": "suffix",
},
{
"format": "string",
"maxLength": 512,
"title": "Field",
"type": ["null", "string"],
},
),
TestCase(
"string",
"autonumber",
512,
None,
"Field",
[],
None,
{
"airbyte_type": "big_integer",
"maxLength": 512,
"title": "Field",
"type": ["null", "string"],
},
),
),
)