コード例 #1
0
ファイル: helper.py プロジェクト: spjatin4/dynamic-singer
    def __next__(self):
        row = self.tap.emit()
        if row:
            if not isinstance(row, dict):
                raise ValueError('tap.emit() must returned a dict')
            if self.tap_key not in row:
                raise ValueError('tap key not exist in elements from tap')

            if not self.tap_schema:
                self.builder.add_object(row)
                schema = self.builder.to_schema()
            else:
                schema = self.tap_schema

            if isinstance(self.tap_key, (str, bytes)):
                key_properties = [self.tap_key]
            if not isinstance(key_properties, list):
                raise Exception('tap key must be a string or list of strings')

            r = SchemaMessage(
                stream = self.tap_name,
                schema = schema,
                key_properties = key_properties,
                bookmark_properties = None,
            )
            s = format_message(r)
            r = RecordMessage(
                stream = self.tap_name, record = row, time_extracted = None
            )
            r = format_message(r)
            row = (s.encode(), r.encode())
        return row
コード例 #2
0
ファイル: utils.py プロジェクト: nicholas-ramsey/ordway-tap
def print_record(tap_stream_id: str,
                 record: Dict[str, Any],
                 version: Optional[int] = None):
    """ Writes record data to stdout """

    write_message(
        RecordMessage(tap_stream_id, record, version,
                      time_extracted=now()))  # pragma: no cover
コード例 #3
0
ファイル: helper.py プロジェクト: cheunhong/dynamic-singer
def transformation(rows, builder, function: Callable, tap_schema = None):

    results = []

    for line in rows:
        try:
            msg = singer.parse_message(line)
        except json.decoder.JSONDecodeError:
            logger.error('Unable to parse:\n{}'.format(line))
            raise

        if isinstance(msg, singer.RecordMessage):
            record = msg.record
            record = function(record)
            if record:
                if isinstance(record, tuple):
                    if len(record) != 2:
                        raise ValueError(
                            'transformation must returned (row, dictionary) or row.'
                        )
                    record, types = record
                else:
                    types = None
                builder.add_object(record)
                schema = builder.to_schema()
                if tap_schema:
                    for k, v in tap_schema['properties'].items():
                        if k in schema['properties']:
                            schema['properties'][k] = v
                if types:
                    for k, v in types.items():
                        if k in schema['properties']:
                            v = type_mapping.get(v, v)
                            if not isinstance(v, str):
                                raise ValueError(
                                    f'value {v} from {k} not supported.'
                                )
                            schema['properties'][k] = {'type': v}

                tap_name = msg.stream
                r = SchemaMessage(
                    stream = tap_name,
                    schema = schema,
                    key_properties = None,
                    bookmark_properties = None,
                )
                s = format_message(r)
                r = RecordMessage(
                    stream = tap_name, record = record, time_extracted = None
                )
                r = format_message(r)
                row = [s.encode(), r.encode()]
                results.extend(row)

        else:
            results.append(line)

    return results
コード例 #4
0
def write_record(stream_name, record, time_extracted, version=None):
    try:
        if version:
            singer.messages.write_message(
                RecordMessage(stream=stream_name,
                              record=record,
                              version=version,
                              time_extracted=time_extracted))
        else:
            singer.messages.write_record(stream_name=stream_name,
                                         record=record,
                                         time_extracted=time_extracted)
    except OSError as err:
        LOGGER.info('OS Error writing record for: {}'.format(stream_name))
        raise err
コード例 #5
0
ファイル: helper.py プロジェクト: spjatin4/dynamic-singer
def transformation(rows, builder, function: Callable):

    results = []

    for line in rows:
        try:
            msg = singer.parse_message(line)
        except json.decoder.JSONDecodeError:
            logger.error('Unable to parse:\n{}'.format(line))
            raise

        if isinstance(msg, singer.RecordMessage):
            record = msg.record
            record = function(record)
            if record:
                builder.add_object(record)
                schema = builder.to_schema()
                tap_name = msg.stream
                r = SchemaMessage(
                    stream = tap_name,
                    schema = schema,
                    key_properties = None,
                    bookmark_properties = None,
                )
                s = format_message(r)
                r = RecordMessage(
                    stream = tap_name, record = record, time_extracted = None
                )
                r = format_message(r)
                row = [s.encode(), r.encode()]
                results.extend(row)

        else:
            results.append(line)

    return results
コード例 #6
0
 def test_records_included(self):
     self.assertMessagesIncludesAll(
         [
             RecordMessage(
                 "customers",
                 record={
                     "name": "i9wztyc",
                     "description": None,
                     "parent_customer": None,
                     "website": None,
                     "payment_terms": "Due on Receipt",
                     "billing_cycle_day": "16th Day Of The Month",
                     "billing_contact_id": "CT-88158",
                     "shipping_contact_id": "CT-88158",
                     "status": "Active",
                     "billing_batch": "business",
                     "tax_exempt": False,
                     "balance": 50713.0,
                     "auto_pay": True,
                     "currency": "USD",
                     "edit_auto_pay": True,
                     "price_book_id": None,
                     "cmrr": 22286.0,
                     "discounted_cmrr": 20131.0,
                     "delivery_preferences": {
                         "print": True,
                         "email": True
                     },
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                     "created_date": "2020-10-16T19:31:19.502000Z",
                     "updated_date": "2020-10-16T19:32:54.563000Z",
                     "pay_now_url": "at6q5masw265um515ispd5uskustcos2lx0",
                     "update_payment_method_url": "xwqlbzehivqjo30p",
                     "open_invoices_url": "4p5tjvzqhp",
                     "custom_fields": {},
                     "company_id": "test_company",
                     "customer_id": "N7v1duJIv8rvrUr",
                 },
                 version=123000,
             ),
             RecordMessage(
                 "customers",
                 record={
                     "name": "jgyh40yp9tk6ybxqtx6zaqcsmgx",
                     "description": None,
                     "parent_customer": None,
                     "website": None,
                     "payment_terms": "Due on Receipt",
                     "billing_cycle_day": "16th Day Of The Month",
                     "billing_contact_id": "CT-88174",
                     "shipping_contact_id": "CT-88174",
                     "status": "Active",
                     "billing_batch": "business",
                     "tax_exempt": False,
                     "balance": 21026.0,
                     "auto_pay": True,
                     "currency": "USD",
                     "edit_auto_pay": True,
                     "price_book_id": None,
                     "cmrr": 2623.0,
                     "discounted_cmrr": 39803.0,
                     "delivery_preferences": {
                         "print": True,
                         "email": True
                     },
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                     "created_date": "2020-10-16T21:21:41.016000Z",
                     "updated_date": "2020-10-16T23:02:54.851000Z",
                     "pay_now_url": "ha5jvh8qagng5oxv",
                     "update_payment_method_url": "t0dltueq7b9da3uab4gxyff",
                     "open_invoices_url": "mdebzyainmov44",
                     "custom_fields": {},
                     "company_id": "test_company",
                     "customer_id": "kkwBsUdKdC1JBS2",
                 },
                 version=123000,
             ),
             RecordMessage(
                 "customers",
                 record={
                     "name": "d4px1rsg3jdqtghwkcz7vz5hap2nf8d79332ob2x",
                     "description": None,
                     "parent_customer": None,
                     "website": None,
                     "payment_terms": "Due on Receipt",
                     "billing_cycle_day": "15th Day Of The Month",
                     "billing_contact_id": "CT-88162",
                     "shipping_contact_id": "CT-88162",
                     "status": "Active",
                     "billing_batch": "business",
                     "tax_exempt": False,
                     "balance": 1772.0,
                     "auto_pay": True,
                     "currency": "USD",
                     "edit_auto_pay": True,
                     "price_book_id": None,
                     "cmrr": 78433.0,
                     "discounted_cmrr": 8894.0,
                     "delivery_preferences": {
                         "print": True,
                         "email": True
                     },
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                     "created_date": "2020-10-16T20:00:02.722000Z",
                     "updated_date": "2020-10-16T20:02:25.228000Z",
                     "pay_now_url":
                     "xuj6l44hzqoymcv5p8ld0fbads2ovlgiq8oqrv6ua",
                     "update_payment_method_url":
                     "gdqj1hbma0gfvptn982isax7rk68vf09c7",
                     "open_invoices_url": "etj7pqvz4p5w0yp288auf9buitc",
                     "custom_fields": {},
                     "company_id": "test_company",
                     "customer_id": "yFCMqkp73scyiQcv",
                 },
                 version=123000,
             ),
             RecordMessage(
                 "customers",
                 record={
                     "name": "belczvbzhbtc1seqrrftkenvd",
                     "description": None,
                     "parent_customer": None,
                     "website": None,
                     "payment_terms": "Due on Receipt",
                     "billing_cycle_day": "16th Day Of The Month",
                     "billing_contact_id": "CT-88159",
                     "shipping_contact_id": "CT-88159",
                     "status": "Active",
                     "billing_batch": "business",
                     "tax_exempt": False,
                     "balance": 74522.0,
                     "auto_pay": True,
                     "currency": "USD",
                     "edit_auto_pay": True,
                     "price_book_id": None,
                     "cmrr": 93601.0,
                     "discounted_cmrr": 2060.0,
                     "delivery_preferences": {
                         "print": True,
                         "email": True
                     },
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                     "created_date": "2020-10-16T19:41:18.673000Z",
                     "updated_date": "2020-10-16T19:43:38.073000Z",
                     "pay_now_url": "ht4a337rcece6rlik9f5cy",
                     "update_payment_method_url": "2vu23my8",
                     "open_invoices_url": "qpd3pu7tbor",
                     "custom_fields": {},
                     "company_id": "test_company",
                     "customer_id": "cozNeo20GBHCWLu",
                 },
                 version=123000,
             ),
             RecordMessage(
                 "customers",
                 record={
                     "name": "zbsc2gvvxakz6nibsimyax43",
                     "description": None,
                     "parent_customer": None,
                     "website": None,
                     "payment_terms": "Due on Receipt",
                     "billing_cycle_day": "16th Day Of The Month",
                     "billing_contact_id": "CT-88167",
                     "shipping_contact_id": "CT-88167",
                     "status": "Active",
                     "billing_batch": "business",
                     "tax_exempt": False,
                     "balance": 1970.0,
                     "auto_pay": True,
                     "currency": "USD",
                     "edit_auto_pay": True,
                     "price_book_id": None,
                     "cmrr": 92360.0,
                     "discounted_cmrr": 64188.0,
                     "delivery_preferences": {
                         "print": True,
                         "email": True
                     },
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                     "created_date": "2020-10-16T20:19:22.440000Z",
                     "updated_date": "2020-10-20T17:01:22.101000Z",
                     "pay_now_url": "f7yka8ysgcfgecgb7ohee58vjr",
                     "update_payment_method_url":
                     "8vitcekglzid7xi99y8b8tbqnui03jay639pk851fc531d",
                     "open_invoices_url":
                     "026xtvzuahmr76v7xqpmqip3ezggamwrb16ptjscbxevvcosnx",
                     "custom_fields": {},
                     "company_id": "test_company",
                     "customer_id": "spg65QiZr828hvP",
                 },
                 version=123000,
             ),
         ],
         ignored_keys=["company_id"],
     )
コード例 #7
0
 def test_records_included(self):
     self.assertMessagesIncludesAll(
         [
             RecordMessage(
                 "refunds",
                 record={
                     "customer_id": "rLk3NloE8Cn1Pvo",
                     "refund_date": "2020-11-02",
                     "refund_amount": 33198.0,
                     "refund_type": "Electronic",
                     "payment_id": "PMT-05318",
                     "notes": "m661adkvdc0d7u3em2ky",
                     "currency": "USD",
                     "reference_number": "x7b6zlj21702xdxc0jyy30i85wd5l",
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                     "created_date": "2020-11-02T18:02:37.250000Z",
                     "updated_date": "2020-11-02T18:02:38.317000Z",
                     "company_id": "test_company",
                     "refund_id": "REF-00120",
                 },
                 version=None,
             ),
             RecordMessage(
                 "refunds",
                 record={
                     "customer_id": "XFhLE2GY6eNcSQl",
                     "refund_date": "2020-11-02",
                     "refund_amount": 96069.0,
                     "refund_type": "Electronic",
                     "payment_id": "PMT-05353",
                     "notes": "6727rxtwkksv80g92x6sh34",
                     "currency": "USD",
                     "reference_number":
                     "f87vqnewvdcjpqp5jlspvvo77d6hsp9qsdfzgoe1213vwx4g4",
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                     "created_date": "2020-11-02T18:44:46.172000Z",
                     "updated_date": "2020-11-02T18:44:47.532000Z",
                     "company_id": "test_company",
                     "refund_id": "REF-00121",
                 },
                 version=None,
             ),
             RecordMessage(
                 "refunds",
                 record={
                     "customer_id": "NBMaZz9VZejISz0",
                     "refund_date": "2020-11-02",
                     "refund_amount": 22353.0,
                     "refund_type": "Electronic",
                     "payment_id": "PMT-05305",
                     "notes": "pp7zbsk4wottfz7745sly00b9pa",
                     "currency": "USD",
                     "reference_number": "xhigeq7graa5l2qdhnij3t",
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                     "created_date": "2020-11-03T07:40:47.001000Z",
                     "updated_date": "2020-11-03T07:40:48.222000Z",
                     "company_id": "test_company",
                     "refund_id": "REF-00122",
                 },
                 version=None,
             ),
             RecordMessage(
                 "refunds",
                 record={
                     "customer_id": "Gj2bYtxgmlJKDTW",
                     "refund_date": "2020-11-11",
                     "refund_amount": 77829.0,
                     "refund_type": "Electronic",
                     "payment_id": "PMT-03859",
                     "notes": "capwlc8yyni4nnblm",
                     "currency": "USD",
                     "reference_number":
                     "vx4p7nz9v4tivnobcb4j9p1g5iykottqn2o8ztia08rn5zzjk",
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                     "created_date": "2020-11-11T18:35:50.911000Z",
                     "updated_date": "2020-11-11T18:35:52.362000Z",
                     "company_id": "test_company",
                     "refund_id": "REF-00131",
                 },
                 version=None,
             ),
             RecordMessage(
                 "refunds",
                 record={
                     "customer_id": "kOR9WGPnR1KSt5I",
                     "refund_date": "2020-11-11",
                     "refund_amount": 71864.0,
                     "refund_type": "Electronic",
                     "payment_id": "PMT-05514",
                     "notes": "afjhm202xrhzdk3sj3ndyuwuyaqb6qpwkxhgr6",
                     "currency": "USD",
                     "reference_number":
                     "em39h71s4iz9jkchexvghs62lhef9ot0x4odcl",
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                     "created_date": "2020-11-11T17:51:07.300000Z",
                     "updated_date": "2020-11-11T17:51:08.589000Z",
                     "company_id": "test_company",
                     "refund_id": "REF-00130",
                 },
                 version=None,
             ),
         ],
         ignored_keys=["company_id"],
     )
コード例 #8
0
 def test_records_included(self):
     self.assertMessagesIncludesAll(
         [
             RecordMessage(
                 "contacts",
                 record={
                     "customer_id": "e4dHaYUv4bAunAd",
                     "first_name": "p02y0lfu7m47pu6yqxcxzhn0suesb5",
                     "last_name": "grjexiyh7rjolq3h62",
                     "display_name": "xlrt27lloqchvw5965wfyc9lk",
                     "email": "*****@*****.**",
                     "phone": None,
                     "mobile": None,
                     "job_title": None,
                     "department": None,
                     "notes": None,
                     "address1": None,
                     "address2": None,
                     "county": None,
                     "city": None,
                     "state": None,
                     "zip": None,
                     "country": None,
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                     "created_date": "2020-10-16T19:45:32.447000Z",
                     "updated_date": "2020-10-16T19:45:32.447000Z",
                     "custom_fields": {},
                     "company_id": "test_company",
                     "contact_id": "CT-88160",
                 },
                 version=123000,
             ),
             RecordMessage(
                 "contacts",
                 record={
                     "customer_id": "N7v1duJIv8rvrUr",
                     "first_name":
                     "nl0o6ovri528wjrmlvrigsy4g81qihterlwh7gl",
                     "last_name": "fdim652c4f2zkcv7yebehn9wwq",
                     "display_name": "hmf39rknmu0i4xnaqjil1hks019i0teb3nn2",
                     "email": "*****@*****.**",
                     "phone": None,
                     "mobile": None,
                     "job_title": None,
                     "department": None,
                     "notes": None,
                     "address1": None,
                     "address2": None,
                     "city": None,
                     "county": None,
                     "state": None,
                     "zip": None,
                     "country": None,
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                     "created_date": "2020-10-16T19:31:19.549000Z",
                     "updated_date": "2020-10-16T19:31:19.549000Z",
                     "custom_fields": {},
                     "company_id": "test_company",
                     "contact_id": "CT-88158",
                 },
                 version=123000,
             ),
             RecordMessage(
                 "contacts",
                 record={
                     "customer_id": "A0EQe9nw7DclBnX",
                     "first_name": "5u15gjpn0f7uw1rowku95zv",
                     "last_name": "j4",
                     "display_name":
                     "vwexegsm3n28f5boiiyz1k9mia7xuwgu60hizgc0sdgve0",
                     "email": "*****@*****.**",
                     "phone": None,
                     "mobile": None,
                     "job_title": None,
                     "department": None,
                     "notes": None,
                     "address1": None,
                     "address2": None,
                     "city": None,
                     "county": None,
                     "state": None,
                     "zip": None,
                     "country":
                     "8faz6oomg86jpf9wjdo7mkqxdnvg9cjyaihspjwjur4h81",
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                     "created_date": "2020-10-16T22:55:37.406000Z",
                     "updated_date": "2020-10-27T23:45:57.487000Z",
                     "custom_fields": {},
                     "company_id": "test_company",
                     "contact_id": "CT-88178",
                 },
                 version=123000,
             ),
             RecordMessage(
                 "contacts",
                 record={
                     "customer_id": "LKhGmEpWAugaPjh",
                     "first_name":
                     "autv8md9l57khvzyr21g0lubnt8kgwv7x3xvpxw70ga8h9",
                     "last_name": "lyqvguco0w8s1p6c2sheqpwd9i6fyc689ku",
                     "display_name": "75f7sk9qpt33y41yrwhll6z1oh7",
                     "email": "*****@*****.**",
                     "phone": None,
                     "mobile": None,
                     "job_title": None,
                     "department": None,
                     "notes": None,
                     "address1": None,
                     "address2": None,
                     "city": None,
                     "county": None,
                     "state": None,
                     "zip": None,
                     "country": None,
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                     "created_date": "2020-10-16T22:45:12.855000Z",
                     "updated_date": "2020-10-16T22:45:12.856000Z",
                     "custom_fields": {},
                     "company_id": "test_company",
                     "contact_id": "CT-88176",
                 },
                 version=123000,
             ),
             RecordMessage(
                 "contacts",
                 record={
                     "customer_id": "kOR9WGPnR1KSt5I",
                     "first_name": None,
                     "last_name": None,
                     "display_name": "jm",
                     "email": None,
                     "phone": None,
                     "mobile": None,
                     "job_title": None,
                     "department": None,
                     "notes": None,
                     "address1": None,
                     "address2": None,
                     "city": None,
                     "county": None,
                     "state": None,
                     "zip": None,
                     "country": "537htd4hooc",
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                     "created_date": "2020-10-16T19:55:35.770000Z",
                     "updated_date": "2020-10-16T19:55:35.770000Z",
                     "custom_fields": {},
                     "company_id": "test_company",
                     "contact_id": "CT-88161",
                 },
                 version=123000,
             ),
             RecordMessage(
                 "contacts",
                 record={
                     "customer_id": "kkwBsUdKdC1JBS2",
                     "first_name": "eob5tx31aiy7s",
                     "last_name": "ox3h22zhfg8zethi7yg1g2ifviw5e",
                     "display_name": "7orr6b6y5nftrajo6o0p86mmkrbie8bij1",
                     "email": "*****@*****.**",
                     "phone": None,
                     "mobile": None,
                     "job_title": None,
                     "department": None,
                     "notes": None,
                     "address1":
                     "zh9edtwpwmtpdt1pb5vba0r5hdgxp0tsb6fuhh83z8i1gqps4r",
                     "address2": None,
                     "city": "JlU8tGhYGbcp02d",
                     "county": None,
                     "state": "lqr4w3ko47o4k3vmp8b84lbcradofba",
                     "zip":
                     "6pm37ou0ebg05rccrji73mfkxc8ugnqo7lrr8sj04w9uvg",
                     "country": "wj6oraqg9ovb4v45lq7yqdyt6ctznvrflu8tjnyk",
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                     "created_date": "2020-10-16T21:21:41.067000Z",
                     "updated_date": "2020-10-16T21:21:41.067000Z",
                     "custom_fields": {},
                     "company_id": "test_company",
                     "contact_id": "CT-88174",
                 },
                 version=123000,
             ),
         ],
         ignored_keys=["company_id"],
     )
コード例 #9
0
 def test_records_included(self):
     self.assertMessagesIncludesAll(
         [
             RecordMessage(
                 "invoices",
                 record={
                     "subscription_id": "S-01245",
                     "customer_id": "Tf4lCBZLFQwJJHM",
                     "customer_name": "c6n02hig9ttf",
                     "product_id": "P-00005",
                     "product_name": "hgaac9t09crpais2k8",
                     "plan_id": "PLN-00013",
                     "plan_name": "1z40xx8tjasz8wzu1k4boxa8amedj0ivrk",
                     "charge_id": "CHG-00013",
                     "subscription_line_id": "SCHG-01",
                     "charge_name": "n2agax0y1u39t3r25acn0euzfultx",
                     "charge_type": "recurring",
                     "description": "b85rjlkgpypzupw14vsxb9do515deo",
                     "start_date": "2020-10-20",
                     "end_date": "2020-11-19",
                     "unit_price": 1521.0,
                     "list_price": 31562.0,
                     "list_price_base": "Billing Period",
                     "taxable": False,
                     "quantity": 11116.0,
                     "discount": 0.0,
                     "effective_price": 97861.0,
                     "line_tax": 21599.0,
                     "tax_lines": [],
                     "applied_tiers": None,
                     "custom_fields": {},
                     "company_id": "test_company",
                     "invoice_id": "INV-06011",
                     "invoice_line_no": "1",
                     "billing_contact": {
                         "zip":
                         "mohcr4c15u7zn30tji",
                         "city":
                         "6czu4",
                         "email":
                         "*****@*****.**",
                         "phone":
                         "",
                         "state":
                         "46tnbhnz8tmhgklvv2hhkyzikd48nt9qsxsjy18yrdcsw0",
                         "county":
                         "",
                         "mobile":
                         "",
                         "country":
                         "yoluvps6febu2cuhrbsy3do2ksdwp9ya5l",
                         "address1":
                         "xyq68200cstjd2kwgf3rjiads8bglnvtjqglr",
                         "address2":
                         "",
                         "job_title":
                         "",
                         "last_name":
                         "4c4cmwdb6c3udqf786frq",
                         "department":
                         "",
                         "first_name":
                         "sndp3b0ybap6bcp7aosamw3bxp",
                         "display_name":
                         "hjuvr8zntv6e2qjbznkckgvtnb0k5f1jp9qkax3",
                     },
                     "shipping_contact": {
                         "zip":
                         "y0qbdsu94rjlueqq72",
                         "city":
                         "96ljgtobqwz3th69dlcmzhd6gakpbu4",
                         "email":
                         "*****@*****.**",
                         "phone":
                         "",
                         "state":
                         "kqdhyo52fulkr5friktj0958k7wqt93usfcf",
                         "county":
                         "",
                         "mobile":
                         "",
                         "country":
                         "g0xc6ft3zfkwfxq0lea3opw5lp4eps3di00se57gm4",
                         "address1":
                         "p7g6bmd7dwp2qefkyteuctitila5qdxg04t34w6ldxs",
                         "address2":
                         "",
                         "job_title":
                         "",
                         "last_name":
                         "mzjkz5tihgqrez8fh935",
                         "department":
                         "",
                         "first_name":
                         "gx85kbtndretb5zd6t3qo3rww",
                         "display_name":
                         "umrp56mbkenwopve9fu5c4vnymgviw7vbv4gdt",
                     },
                     "invoice_date": "2020-11-06",
                     "due_date": "2020-11-06",
                     "billing_run_id": "BR-02340",
                     "subtotal": 22160.0,
                     "invoice_tax": 70856.0,
                     "invoice_amount": 44735.0,
                     "paid_amount": 46311.0,
                     "balance": 19552.0,
                     "status": "Partially paid",
                     "notes": None,
                     "currency": "USD",
                     "payment_terms": "0",
                     "line_custom_fields": {},
                     "updated_date": "2020-11-10T21:27:26.955000Z",
                     "created_date": "2020-11-06T08:01:30.410000Z",
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                 },
                 version=1,
             ),
             RecordMessage(
                 "invoices",
                 record={
                     "subscription_id": "S-01748",
                     "customer_id": "uiPfZCmRf6YcmM3",
                     "customer_name":
                     "ccfr5daarxvyg3kuo776gcl1wfvxdfdl9gpgcu6hx",
                     "product_id": "P-00122",
                     "product_name": "uh40oj4etcnmbhcb99q9esnsy7r3khwv",
                     "plan_id": "PLN-00022",
                     "plan_name": "0bl72pu8mca0vez6be3o",
                     "charge_id": "CHG-00022",
                     "subscription_line_id": "SCHG-02",
                     "charge_name":
                     "82eif3fzu4vvsj7ehowubc360jb88xpgpnuf9h49kuay",
                     "charge_type": "recurring",
                     "description":
                     "6oz2e05gx3dizne28b20x9h5sv3lafzs9v0jxpru1",
                     "start_date": "2020-10-18",
                     "end_date": "2021-01-17",
                     "unit_price": 37774.0,
                     "list_price": 93161.0,
                     "list_price_base": "Billing Period",
                     "taxable": False,
                     "quantity": 79808.0,
                     "discount": 0.0,
                     "effective_price": 77944.0,
                     "line_tax": 74460.0,
                     "tax_lines": [],
                     "applied_tiers": None,
                     "custom_fields": {},
                     "company_id": "test_company",
                     "invoice_id": "INV-04720",
                     "invoice_line_no": "1",
                     "billing_contact": {
                         "zip": "",
                         "city": "",
                         "email": "*****@*****.**",
                         "phone": "",
                         "state": "",
                         "county": "",
                         "mobile": "",
                         "country": "",
                         "address1": "",
                         "address2": "",
                         "job_title": "",
                         "last_name":
                         "pfegs42j8xhpa4117h4r8qxsjjic4k3ul17somsltgr",
                         "department": "",
                         "first_name": "ch2zjx66v6dknyv9t05k",
                         "display_name": "ctlysi39w3p6ftohbsfftxg07ioij",
                     },
                     "shipping_contact": {
                         "zip":
                         "",
                         "city":
                         "",
                         "email":
                         "*****@*****.**",
                         "phone":
                         "",
                         "state":
                         "",
                         "county":
                         "",
                         "mobile":
                         "",
                         "country":
                         "",
                         "address1":
                         "",
                         "address2":
                         "",
                         "job_title":
                         "",
                         "last_name":
                         "zcwgenue175in2kuoftq9beiqn6m1phxlmhe27qycibg9",
                         "department":
                         "",
                         "first_name":
                         "v97c6gbz3oq35v95gopca99eqb4r83dus8nd4cq3ez5jtwfzk",
                         "display_name":
                         "adjlxfp1uf1dwbo0g2wyrbj355znt9l91zrrydxvgcrsqzb3mr",
                     },
                     "invoice_date": "2020-10-18",
                     "due_date": "2020-10-18",
                     "billing_run_id": "BR-02010",
                     "subtotal": 26170.0,
                     "invoice_tax": 31694.0,
                     "invoice_amount": 74369.0,
                     "paid_amount": 83388.0,
                     "balance": 61611.0,
                     "status": "Paid",
                     "notes": None,
                     "currency": "USD",
                     "payment_terms": "0",
                     "line_custom_fields": {},
                     "updated_date": "2020-11-10T21:46:36.606000Z",
                     "created_date": "2020-10-18T08:06:03.598000Z",
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                 },
                 version=1,
             ),
             RecordMessage(
                 "invoices",
                 record={
                     "subscription_id": "S-01748",
                     "customer_id": "uiPfZCmRf6YcmM3",
                     "customer_name":
                     "ccfr5daarxvyg3kuo776gcl1wfvxdfdl9gpgcu6hx",
                     "product_id": "P-00005",
                     "product_name": "tzgzblnfsna0ic8",
                     "plan_id": "PLN-00013",
                     "plan_name": "exg6mf67o5vcw37hga299rl0ticxe0zxxnvq",
                     "charge_id": "CHG-00013",
                     "subscription_line_id": "SCHG-01",
                     "charge_name": "wmgqwbqlma52fzgzzasl4ympoxcwjbiw6j6k0",
                     "charge_type": "recurring",
                     "description": "xv4higzl",
                     "start_date": "2020-10-18",
                     "end_date": "2021-01-17",
                     "unit_price": 19906.0,
                     "list_price": 5535.0,
                     "list_price_base": "Billing Period",
                     "taxable": False,
                     "quantity": 3264.0,
                     "discount": 0.0,
                     "effective_price": 33077.0,
                     "line_tax": 80632.0,
                     "tax_lines": [],
                     "applied_tiers": None,
                     "custom_fields": {},
                     "company_id": "test_company",
                     "invoice_id": "INV-04720",
                     "invoice_line_no": "2",
                     "billing_contact": {
                         "zip": "",
                         "city": "",
                         "email": "*****@*****.**",
                         "phone": "",
                         "state": "",
                         "county": "",
                         "mobile": "",
                         "country": "",
                         "address1": "",
                         "address2": "",
                         "job_title": "",
                         "last_name":
                         "pfegs42j8xhpa4117h4r8qxsjjic4k3ul17somsltgr",
                         "department": "",
                         "first_name": "ch2zjx66v6dknyv9t05k",
                         "display_name": "ctlysi39w3p6ftohbsfftxg07ioij",
                     },
                     "shipping_contact": {
                         "zip":
                         "",
                         "city":
                         "",
                         "email":
                         "*****@*****.**",
                         "phone":
                         "",
                         "state":
                         "",
                         "county":
                         "",
                         "mobile":
                         "",
                         "country":
                         "",
                         "address1":
                         "",
                         "address2":
                         "",
                         "job_title":
                         "",
                         "last_name":
                         "zcwgenue175in2kuoftq9beiqn6m1phxlmhe27qycibg9",
                         "department":
                         "",
                         "first_name":
                         "v97c6gbz3oq35v95gopca99eqb4r83dus8nd4cq3ez5jtwfzk",
                         "display_name":
                         "adjlxfp1uf1dwbo0g2wyrbj355znt9l91zrrydxvgcrsqzb3mr",
                     },
                     "invoice_date": "2020-10-18",
                     "due_date": "2020-10-18",
                     "billing_run_id": "BR-02010",
                     "subtotal": 26170.0,
                     "invoice_tax": 31694.0,
                     "invoice_amount": 74369.0,
                     "paid_amount": 83388.0,
                     "balance": 61611.0,
                     "status": "Paid",
                     "notes": None,
                     "currency": "USD",
                     "payment_terms": "0",
                     "line_custom_fields": {},
                     "updated_date": "2020-11-10T21:46:36.606000Z",
                     "created_date": "2020-10-18T08:06:03.598000Z",
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                 },
                 version=1,
             ),
             RecordMessage(
                 "invoices",
                 record={
                     "subscription_id": "S-01607",
                     "customer_id": "mvlm8gBHhTf1mB6",
                     "customer_name":
                     "6ht3arffdok81b0mh1oc7721jjdang6i8pn4",
                     "product_id": "P-00005",
                     "product_name": "kz3kn03qcw7v0a2ceg",
                     "plan_id": "PLN-00013",
                     "plan_name":
                     "10hjst75p1ls0ckhado0xpno2h101fqgulb1y8zal",
                     "charge_id": "CHG-00013",
                     "subscription_line_id": "SCHG-01",
                     "charge_name": "7xi4xztofgn9r6z90r1crq",
                     "charge_type": "recurring",
                     "description": "s6vryanbun9x2ynpbbd7vf5h9pqzsn",
                     "start_date": "2020-11-10",
                     "end_date": "2020-12-09",
                     "unit_price": 27153.0,
                     "list_price": 86154.0,
                     "list_price_base": "Billing Period",
                     "taxable": False,
                     "quantity": 11941.0,
                     "discount": 0.0,
                     "effective_price": 56298.0,
                     "line_tax": 55107.0,
                     "tax_lines": [],
                     "applied_tiers": None,
                     "custom_fields": {},
                     "company_id": "test_company",
                     "invoice_id": "INV-06184",
                     "invoice_line_no": "1",
                     "billing_contact": {
                         "zip": "b66g6uqmtjpyiwf5wt",
                         "city": "3mxzraht",
                         "email": "*****@*****.**",
                         "phone": "",
                         "state":
                         "xrtu82a8011ppk58xogx5ai7c94w8m3435q5siufwcn5d0sm",
                         "county": "",
                         "mobile": "",
                         "country": "jskchmcjyp",
                         "address1": "8rka",
                         "address2": "",
                         "job_title": "",
                         "last_name":
                         "riljonfa7ckiqd18gh2mg5c7y4h3earoboah9e0nq8p9lcaqe",
                         "department": "",
                         "first_name": "oqhgoewao8me1h1135dq07",
                         "display_name": "kz7mxvjf1waogamblajvxr2f",
                     },
                     "shipping_contact": {
                         "zip": "0wuawdo",
                         "city": "3maxesensw64dnz70uqp8796y",
                         "email": "*****@*****.**",
                         "phone": "",
                         "state": "5t7hnk0dshallnm8ap59ey9q3154q5hxz0q",
                         "county": "",
                         "mobile": "",
                         "country": "0st69usdzeto74a2s8qpeh580p2kdz",
                         "address1": "lj",
                         "address2": "",
                         "job_title": "",
                         "last_name":
                         "9fc252s3stkqx2qa36iiml23nw12fwa0i22vjiq661459wdyz",
                         "department": "",
                         "first_name": "ej",
                         "display_name": "yfas0zucjobtws2rq3rzdx1ecv1z1jo2",
                     },
                     "invoice_date": "2020-11-10",
                     "due_date": "2020-11-10",
                     "billing_run_id": "BR-02363",
                     "subtotal": 57006.0,
                     "invoice_tax": 88965.0,
                     "invoice_amount": 49136.0,
                     "paid_amount": 59809.0,
                     "balance": 14074.0,
                     "status": "Paid",
                     "notes": None,
                     "currency": "USD",
                     "payment_terms": "Due on Receipt",
                     "line_custom_fields": {},
                     "updated_date": "2020-11-10T08:17:59.594000Z",
                     "created_date": "2020-11-10T08:03:37.974000Z",
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                 },
                 version=1,
             ),
         ],
         ignored_keys=["company_id"],
     )
コード例 #10
0
 def test_all_records_included(self):
     self.assertMessagesIncludesAll(
         [
             RecordMessage(
                 "plans",
                 record={
                     "name": "fhynhq1m8siyza0ij360kph7nk9",
                     "status": "Active",
                     "description": None,
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                     "created_date": "2020-08-20T21:52:27.245000Z",
                     "updated_date": "2020-08-20T21:52:27.245000Z",
                     "public_url": None,
                     "custom_fields": {"Type": ""},
                     "company_id": "test_company",
                     "plan_id": "PLN-00121",
                 },
                 version=123000,
             ),
             RecordMessage(
                 "plans",
                 record={
                     "name": "x7dh315h4o",
                     "status": "Active",
                     "description": None,
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                     "created_date": "2020-08-20T21:51:57.921000Z",
                     "updated_date": "2020-08-20T21:51:57.921000Z",
                     "public_url": None,
                     "custom_fields": {"Type": ""},
                     "company_id": "test_company",
                     "plan_id": "PLN-00120",
                 },
                 version=123000,
             ),
             RecordMessage(
                 "plans",
                 record={
                     "name": "jsqcu0qygpx4z8k6uqnk54obb1t3lk7u7",
                     "status": "Active",
                     "description": None,
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                     "created_date": "2020-08-06T18:05:16.454000Z",
                     "updated_date": "2020-08-06T18:05:16.454000Z",
                     "public_url": None,
                     "custom_fields": {"Type": ""},
                     "company_id": "test_company",
                     "plan_id": "PLN-00119",
                 },
                 version=123000,
             ),
             RecordMessage(
                 "plans",
                 record={
                     "name": "kioycx9av4c99zddrxq3pkuxhkfkdexo4f275k4ubl51g5nh",
                     "status": "Active",
                     "description": None,
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                     "created_date": "2020-03-20T19:29:49.142000Z",
                     "updated_date": "2020-08-24T17:26:32.059000Z",
                     "public_url": None,
                     "custom_fields": {"Type": ""},
                     "company_id": "test_company",
                     "plan_id": "PLN-00027",
                 },
                 version=123000,
             ),
             RecordMessage(
                 "plans",
                 record={
                     "name": "3ocsblb1by38d03hrb58trojs7uedm6p",
                     "status": "Active",
                     "description": None,
                     "created_by": "*****@*****.**",
                     "updated_by": "*****@*****.**",
                     "created_date": "2020-03-20T19:27:02.679000Z",
                     "updated_date": "2020-09-17T00:15:57.107000Z",
                     "public_url": None,
                     "custom_fields": {"Type": ""},
                     "company_id": "test_company",
                     "plan_id": "PLN-00025",
                 },
                 version=123000,
             ),
         ],
         ignored_keys=["company_id"],
     )