question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running tests not against the live HubSpot demo account

See original GitHub issue

My colleagues and I a currently working on extending the contacts API (as mentioned also in https://github.com/jpetrucciani/hubspot3/issues/39).

The tests for this (and other) API rely on HubSpot’s live demo account. This causes some problems. Mainly the tests are failing at the moment because the demo account has reached its daily limit. We need to wait until the next day, when the limit is reset, to run all tests, hoping is has not been exceeded again.

Furthermore the tests can fail when the live database does not contain the expected records. Two examples: When the database is flushed, all tests relying on the contact from the BASE_CONTACT would fail. And if there are less than 20 records in the database, testing the limit parameter in the test test_get_all will not fail but will not test anything useful either since there will always be less than 20 results, regardless of the parameter value.

As a solution we would suggest to mock the API calls and their responses in the current unit tests. We would include the necessary changes (at least for the contact API tests) in the following PR.

Let me know what do you think.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
rheinwerk-mpcommented, Jun 26, 2019

Great that you are open changing the tests.

Regarding testing against the live API: Yes, but I would suggest to create a different set of tests (integration tests) for this purpose. The unit tests on the other hand would only test the integrity of the code itself.

0reactions
jpetruccianicommented, Jun 28, 2019

As of the latest commit/release 3.2.17, I’ve included my test account key in the tests, so we should be able to use that key for integration tests (so at least we can get the old tests back up and running on Travis!). I’ve also switched the CI to use tox across the three supported versions we’ve specified.

I’m still on board with also building out a bunch of unit tests for the library that use your mocking methods - I’ll just start slowly writing out some new tests when I get some more time!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I create a test account? - HubSpot API
Manually: Go to your developer account's Testing dashboard and hover over the row for the test account you want to renew. Click the...
Read more >
Changes to the public API demo account - HubSpot Developers
If you have any tests running against the public demo account, you will want to create a test account, and move any tests...
Read more >
Run an A/B test on your page - HubSpot Knowledge Base
A/B testing allows you to test two versions of a page at the same URL to see which one performs better. Half of...
Read more >
Sync custom fields between test and main account
Currently this is not supported by HubSpot natively. There are however some workarounds: You could use HubSpot API endpoints to copy properties from...
Read more >
Test your workflow - HubSpot Knowledge Base
If GDPR has been enabled for your account, if your account uses marketing contacts, or if you've unsubscribed from your account's marketing ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found