-
Notifications
You must be signed in to change notification settings - Fork 0
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
A start to moving TCIntercom to FastAPI #318
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #318 +/- ##
============================================
+ Coverage 48.42% 100.00% +51.57%
============================================
Files 7 8 +1
Lines 285 271 -14
============================================
+ Hits 138 271 +133
+ Misses 147 0 -147 ☔ View full report in Codecov by Sentry. |
PrenSJ2
requested changes
Aug 1, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Moving TCIntercom over to FastAPI, brief overview of changes.
setup.cfg
to apyproject.toml
and added ruff instead of black in the reqs.x-hub-signature
.test_main.py
andtest_workers.py
. We now have 100% coverage in the project from these tests and I also updated them all to use@mock.patch
rather than monkeypatch. Additionally updated a lot of the tests so that they actually test and check for a lot more information.raven_dsn
to app settings rather than just using os.env['raven_dsn'], and also addedlogfire_token
to send data to logfire,log_level
for the level of logging which by default is set to 'INFO' and finallyic_secret
so that we can validate webhooks have actually come from Intercom as we weren't doing the before.IMPORTANT BEFORE MERGING:
One thing to note is Heroku is setup to use Docker and I've removed all that so when we merge this, we need to have detached the auto deploy that heroku has for this repo. Then we can merge and I can test deploying this on RenderAlso need to add the new environment variables to the env.
Testing
.env
file that can store your local settings for testing for things such asic_token
,ic_secret
andlogfire_token
Testing the web app:
Check that logs get sent to logfire (web span)
Check that webhooks are received and are processed correctly
x-hub-signature
. For example if you're posting an empty dict you'd do the following:in shell
in your headers:
key value
x-hub-signature
sha1=<digest>
Testing the worker:
worker.py
WorkerSettings
, change the hour=1 to second=1. This will make theupdate_duplicate_contacts
job run once a minute. I'd recommend using the user with email '[email protected]' as there are a lot of users in intercom with that email. You can go to contacts and filter to see them all. What I do to test this, is inget_relevant_accounts
add an if statement after getting email and if it matches '[email protected]', then add them to either the mark_dupe or keep_contacts depending on what you're testing. For example, for marking all users with that email duplicates so you can test the correct one gets marked not a duplicate.and for testing that all the correct users get marked as duplicates by marking everyone with that email not a duplicate:
is_duplicate: False
then the older one gets marked asis_duplicate: True
.is_duplicate: True
that the correct one is marked asis_duplicate: False