Coder Social home page Coder Social logo

Comments (5)

rheinwerk-mp avatar rheinwerk-mp commented on July 17, 2024 2

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.

from hubspot3.

jpetrucciani avatar jpetrucciani commented on July 17, 2024

Thanks for bringing this issue up!

Yeah it'd probably be best to mock those all out - I had started on rebuilding the test suite and quickly ran into all sorts of problems trying to get how I wanted to test things working (including a nasty workaround that you've found in a couple different places for loading a record on boot to use for testing

# since we need to have an id to submit and to attempt to get a contact,
# we need to be hacky here and fetch one upon loading this file.
BASE_CONTACT = CONTACTS.get_all(limit=1)[0]
).

Good point on the test_get_all tests as well - there's a lot of the testing that I hadn't completely thought through when I started writing the tests!

I'd agree with you that mocking the calls would probably be best - I'm open to any methods of doing so that you guys are comfortable with!

from hubspot3.

jpetrucciani avatar jpetrucciani commented on July 17, 2024

I've also created a topic on the HubSpot developer forum about this, and asked if we could potentially have a different key specific for testing - I do feel that mocking it is fine, but not entirely optimal. If we could be hitting the real API during tests, that'd allow us to test for any changes that they've made as well.

from hubspot3.

jpetrucciani avatar jpetrucciani commented on July 17, 2024

Good point - that makes a lot of sense!

from hubspot3.

jpetrucciani avatar jpetrucciani commented on July 17, 2024

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!

from hubspot3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.