Skip to content

Commit

Permalink
Stub out contact_properties api calls in tests
Browse files Browse the repository at this point in the history
Why:

These tests can fail in CI and depend on an API key being available.

This PR:

Removes the need for an API key by using oauth but also mocks out all
the api requests so it can run consistently in CI.
  • Loading branch information
MattMSumner committed Dec 20, 2018
1 parent 32f4683 commit e94a238
Show file tree
Hide file tree
Showing 4 changed files with 267 additions and 113 deletions.
1 change: 0 additions & 1 deletion .env.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
API_KEY="11111111-5555-kkkk-qqqq-999999999999"
APPLICATION_ID=111111
USER_ID=2222222
ACCESS_TOKEN=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA_BBB_CCCC_____-D_EEEEEEEEEEEEEEEEEEEEEEE_fffffff-gggggg"
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ pass.
If you haven't already, create a [developer account] on hubspot. You'll want to
[create an app] and a [test account] as well. Then, create a new file, `.env` in
the root of the repo. Inside you'll need to add an [app id], a HubSpot user id,
an [api key] and an [oauth access token];
and an [oauth access token];

NOTE: Your HubSpot user ID; This can be found in the same place as your
Developer HAPIkey in your Developer portal.
Expand All @@ -417,11 +417,9 @@ Developer HAPIkey in your Developer portal.
[create an app]: https://developers.hubspot.com/docs/faq/how-do-i-create-an-app-in-hubspot
[test account]: https://developers.hubspot.com/docs/faq/how-do-i-create-a-test-account
[app id]: https://developers.hubspot.com/docs/faq/how-do-i-find-the-app-id
[api key]: https://knowledge.hubspot.com/articles/kcs_article/integrations/how-do-i-get-my-hubspot-api-key
[oauth access token]: https://developers.hubspot.com/docs/methods/oauth2/oauth2-overview

```.env
API_KEY="11111111-5555-kkkk-qqqq-999999999999"
APPLICATION_ID=111111
USER_ID=2222222
ACCESS_TOKEN=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA_BBB_CCCC_____-D_EEEEEEEEEEEEEEEEEEEEEEE_fffffff-gggggg"
Expand Down
2 changes: 1 addition & 1 deletion lib/contact_property.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Properties {
getAll(options) {
return this.client._request({
method: 'GET',
path: '/contacts/v2/properties',
path: '/properties/v1/contacts/properties',
qs: options,
})
}
Expand Down
Loading

0 comments on commit e94a238

Please sign in to comment.