Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Integration Tests #5421

Merged
merged 19 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions tests/fixtures/saas/connection_template_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@


@pytest.fixture(scope="function")
def secondary_sendgrid_instance(db):
def secondary_hubspot_instance(db):
"""
Instantiate a `sendgrid` SaaS connector instance
Instantiate a `hubspot` SaaS connector instance
Yields a tuple of the `ConnectionConfig` and `DatasetConfig`
"""
secrets = {
"domain": "test_sendgrid_domain",
"api_key": "test_sendgrid_api_key",
"domain": "test_hubspot_domain",
"private_app_token": "test_hubspot_api_key",
}
connection_config, dataset_config = instantiate_connector(
db,
"sendgrid",
"secondary_sendgrid_instance",
"Sendgrid ConnectionConfig description",
"hubspot",
"secondary_hubspot_instance",
"Hubspot ConnectionConfig description",
secrets,
)
yield connection_config, dataset_config
Expand Down
154 changes: 154 additions & 0 deletions tests/fixtures/saas/test_data/replaceable_hubspot_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
saas_config:
fides_key: <instance_fides_key>
name: HubSpot
type: hubspot
description: A sample schema representing the HubSpot connector for Fides
user_guide: https://docs.ethyca.com/user-guides/integrations/saas-integrations/hubspot
version: 0.0.1
replaceable: True

connector_params:
- name: domain
default_value: api.hubapi.com
description: Your HubSpot domain
- name: private_app_token
sensitive: True
label: Private app token
description: Your HubSpot Private Apps access token

client_config:
protocol: https
host: <domain>
authentication:
strategy: bearer
configuration:
token: <private_app_token>

test_request:
method: GET
path: /settings/v3/users

endpoints:
- name: contacts
requests:
read:
path: /crm/v3/objects/contacts/search
method: POST
body: |
{
"filterGroups": [{
"filters": [{
"value": "<email>",
"propertyName": "email",
"operator": "EQ"
}]
}]
}
query_params:
- name: limit
value: 100
param_values:
- name: email
identity: email
data_path: results
pagination:
strategy: link
configuration:
source: body
path: paging.next.link
update:
request_override: hubspot_contacts_update
param_values:
- name: contactId
references:
- dataset: <instance_fides_key>
field: contacts.id
direction: from
- name: owners
requests:
read:
path: /crm/v3/owners
method: GET
query_params:
- name: limit
value: 100
param_values:
- name: placeholder
identity: email
data_path: results
postprocessors:
- strategy: filter
configuration:
field: email
value:
identity: email
pagination:
strategy: link
configuration:
source: body
path: paging.next.link
- name: subscription_preferences
requests:
read:
path: /communication-preferences/v3/status/email/<email>
method: GET
param_values:
- name: email
identity: email
update:
path: /communication-preferences/v3/unsubscribe
method: POST
body: |
{
"emailAddress": "<email>",
"subscriptionId": "<subscriptionId>",
"legalBasis": "LEGITIMATE_INTEREST_CLIENT",
"legalBasisExplanation": "At users request, we opted them out"
}
data_path: subscriptionStatuses
ignore_errors: [400]
param_values:
- name: email
identity: email
- name: subscriptionId
references:
- dataset: <instance_fides_key>
field: subscription_preferences.id
direction: from
postprocessors:
- strategy: filter
configuration:
field: status
value: SUBSCRIBED
- name: users
requests:
read:
path: /settings/v3/users/
method: GET
query_params:
- name: limit
value: 100
param_values:
- name: placeholder
identity: email
data_path: results
postprocessors:
- strategy: filter
configuration:
field: email
value:
identity: email
pagination:
strategy: link
configuration:
source: body
path: paging.next.link
delete:
path: /settings/v3/users/<userId>
method: DELETE
param_values:
- name: userId
references:
- dataset: <instance_fides_key>
field: users.id
direction: from
120 changes: 0 additions & 120 deletions tests/fixtures/saas/test_data/replaceable_zendesk_config.yml

This file was deleted.

45 changes: 33 additions & 12 deletions tests/fixtures/saas/test_data/saas_example_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,25 @@ saas_config:

consent_requests:
opt_in:
method: POST
path: /allowlists/add
body: |
{
"first_name": "<custom_privacy_request_fields.first_name>"
}
- method: POST
path: /allowlists/add
body: |
{
"first_name": "<custom_privacy_request_fields.first_name>"
}
opt_out:
method: POST
path: /allowlists/delete
body: |
{
"first_name": "<custom_privacy_request_fields.first_name>"
}
- method: POST
path: /allowlists/delete
body: |
{
"first_name": "<custom_privacy_request_fields.first_name>"
}
- method: POST
path: /rejects/add
body: |
{
"first_name": "<custom_privacy_request_fields.first_name>"
}

endpoints:
- name: messages
Expand Down Expand Up @@ -95,6 +101,13 @@ saas_config:
- name: email
identity: email
data_path: exact_matches.members
client_config:
protocol: https
host: <domain>
authentication:
strategy: bearer
configuration:
token: <api_key>
- method: GET
path: /3.0/search-members
query_params:
Expand All @@ -104,6 +117,14 @@ saas_config:
- name: phone
identity: phone
data_path: exact_matches.members
client_config:
protocol: https
host: <domain>
authentication:
strategy: bearer
configuration:
token: <api_key>

update:
method: PUT
path: /3.0/lists/<list_id>/members/<subscriber_hash>
Expand Down
Loading