1
0
mirror of synced 2026-01-03 06:02:23 -05:00
Files
airbyte/airbyte-integrations/connectors/source-drift/source_drift/client/fixture.py
Cole Snodgrass 2e099acc52 update headers from 2022 -> 2023 (#22594)
* It's 2023!

* 2022 -> 2023

---------

Co-authored-by: evantahler <evan@airbyte.io>
2023-02-08 13:01:16 -08:00

55 lines
1.6 KiB
Python

#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
import os
from .api import APIClient
class FakeDataFactory:
@staticmethod
def account(seed):
return {
"ownerId": 2000 + seed,
"name": f"Company Name {seed}",
"domain": f"www.domain.n{seed}.com",
"customProperties": [{"label": "My Number", "name": " my number", "value": 1, "type": "NUMBER"}],
"targeted": True,
}
@staticmethod
def contact(seed):
return {"attributes": {"email": f"airbyte-test-email-{seed}@airbyte.io"}}
@staticmethod
def conversation(seed, email=None):
return {
"email": email or f"airbyte-test-email-{seed}@airbyte.io",
"message": {"body": f"Test conversation message #{seed}", "attributes": {"integrationSource": "Message from airbyte tests"}},
}
@staticmethod
def message(seed):
return {
"type": "chat",
"body": f"Test message #{seed}",
}
def main():
client = APIClient(access_token=os.getenv("DRIFT_TOKEN", "YOUR_TOKEN_HERE"))
# create 120 accounts and 120 conversation with 120 new contacts
for i in range(120):
client.accounts.create(**FakeDataFactory.account(i + 1))
conversation = client.conversations.create(**FakeDataFactory.conversation(i))
# in each conversation create +3 additional messages
for k in range(3):
client.messages.create(conversation_id=conversation["id"], **FakeDataFactory.message(k))
if __name__ == "__main__":
main()