Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

1183 saas connectors shopify erasure #1289

Merged
merged 11 commits into from
Sep 12, 2022

Conversation

ghost
Copy link

@ghost ghost commented Sep 9, 2022

Purpose

  • Purpose of this PR is to add Shopify connector erasure endpoints

Changes

  • Added config for Shopify Erasure Endpoints
  • Updated related dataset and added configuration
  • Added associated tests and fixtures to validate above functionality

Checklist

  • Update CHANGELOG.md file
    • Merge in main so the most recent CHANGELOG.md file is being appended to
    • Add description within the Unreleased section in an appropriate category. Add a new category from the list at the top of the file if the needed one isn't already there.
    • Add a link to this PR at the end of the description with the PR number as the text. example: #1
  • Applicable documentation updated (guides, quickstart, postman collections, tutorial, fidesdemo, database diagram.
  • If docs updated (select one):
    • documentation complete, or draft/outline provided (tag docs-team to complete/review on this branch)
    • documentation issue created (tag docs-team to complete issue separately)
  • Good unit test/integration test coverage
  • This PR contains a DB migration. If checked, the reviewer should confirm with the author that the down_revision correctly references the previous migration before merging
  • The Run Unsafe PR Checks label has been applied, and checks have passed, if this PR touches any external services

Ticket

Fixes #1183

@ghost ghost requested a review from adamsachs September 9, 2022 15:36
Copy link
Contributor

@adamsachs adamsachs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally looks good @HamzaWaseemOnBench , just a few questions that i wanted to check on before merging. happy to chat about it offline if that's easier!

also - please update the CHANGELOG.md (after merging or rebasing off of main), as we'll need that before we can merge the PR.

lastly, do we have the shopify credentials in vault already? if so, let's give this a Run Unsafe PR Checks label so that the full integration test suite runs against it, as it hits external systems.

) -> Generator:
"""
Creates a dynamic test data record for erasure tests.
Yields customer ID as this may be useful to have in test scenarios
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: i'd probably update this comment since it's more than just customer ID that's yielded

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, I'll update it too in new commit.

tests/ops/fixtures/saas/shopify_fixtures.py Show resolved Hide resolved
Comment on lines +498 to +506
assert x == {
f"{dataset_name}:customers": 1,
f"{dataset_name}:blogs": 0,
f"{dataset_name}:customer_orders": 1,
f"{dataset_name}:customer_addresses": 1,
f"{dataset_name}:blog_articles": 0,
f"{dataset_name}:blog_article_comments": 1,
f"{dataset_name}:customer_order_transactions": 0,
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i assume that the updates take too long on the source system (i.e. on the shopify platform) to actually query to make sure our data gets updated - but just want to check.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So here we were first going for only getting existing data in erasure fixture instead of creating new(like we are doing for blogs endpoint). Since after first test data was masked already, quering it again to check if it is masked didn't make sense at that time that is why we didn't add actual query check. Since now as we have changed our approach after discussion and we are actually creating some new data(and deleting it after fixture) it'll be good to add actual query checks, I'll add it now.

Comment on lines +226 to +236
# Deleting order and article after verifying update request
order_delete_response = requests.delete(
url=f"{base_url}/admin/api/2022-07/orders/{order_id}.json",
headers=headers,
)
assert order_delete_response.ok
article_delete_response = requests.delete(
url=f"{base_url}/admin/api/2022-07/articles/{article_id}.json",
headers=headers,
)
assert article_delete_response.ok
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe i'm mising something, but is there a reason we don't delete/clean up the customer that we've created for the test here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes basically we don't have a delete customer endpoint in Shopify API, that is why we can't delete newly created customer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, OK - so do we end up just creating a new customer every time we run a test? could that get unwieldy after a while? just wondering if shopify provides any insight into whether having too many customers could become a problem. i guess it's something they should be able to handle if they don't offer any API to delete a customer.

anyway, not a blocker, especially since i don't think there's a whole lot we can do about this. but i am a little bit concerned we may start running into problems after months of running tests and creating customers each time.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had discussion with Adrian related to it too and we were rooting for approach of not creating customer in every call first too and get already created customer only but we had a problem that data was already masked just after our first call and there was practically no use of our assertions for it so we decided to go for creating customer instead. Since we created a new Shopify store with no data and there is no limit of creating customers as far as we researched so we opted for this solution.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it - thanks for walking through that @HamzaWaseemOnBench !

@ghost ghost requested a review from adamsachs September 9, 2022 22:06
@ghost ghost added the run unsafe ci checks Triggers running of unsafe CI checks label Sep 12, 2022
Copy link
Contributor

@adamsachs adamsachs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this all looks good - thanks for the iterations @HamzaWaseemOnBench!

@adamsachs adamsachs merged commit 44509bf into main Sep 12, 2022
@adamsachs adamsachs deleted the 1183-saas-connectors-shopify-erasure branch September 12, 2022 18:28
sanders41 pushed a commit that referenced this pull request Sep 22, 2022
* Initial commit for erasure endpoints

* Updated endpoints and erasure data approach

* Formatting before making changes

* Fixing duplicate customer_addresses

* Added assertions for update verification

* Fixed isort issue

Co-authored-by: Hamza W <[email protected]>
Co-authored-by: Adrian Galvan <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
run unsafe ci checks Triggers running of unsafe CI checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shopify
2 participants