sendgrid / python-http-client

Twilio SendGrid's Python HTTP Client for calling APIs
https://sendgrid.com
MIT License
126 stars 101 forks source link

Can't run tests without setting up a web service #3

Closed iandouglas closed 8 years ago

iandouglas commented 8 years ago

As quick as it is to set up a simple CRUD interface in something like Flask, a user shouldn't be forced to set up entries in .env in order to run tests. Tests should have a mocked service available to run without any setup by the user.

dtjm commented 8 years ago

hi @iandouglas =)

mbernier commented 8 years ago

Hey @iandouglas!!

Jut to confirm, are you asking for the client to default to a mocked interface if the .env is still set as the default (no entries)

Since this client doesn't call a specific API, what would the mocked interface return to the user?

elbuo8 commented 8 years ago

@mbernier @iandouglas is right. The tests are very binded to SG usage and require dependencies that are not necessary to test the overall functionality of this agnostic client.

The mocked server would ensure that the data being passed is properly formatted/present (payload, URI, method, headers). In response you can set up dummy data that you later ensure that the library is properly parsing and assigning it to each request. So if you change the core of the library, your tests would catch if it broke the overall functionality.

cc/ @thinkingserious

thinkingserious commented 8 years ago

Love the feedback everyone, I'll be implementing these ideas. Thanks!

thinkingserious commented 8 years ago

Fixing with: https://github.com/sendgrid/python-http-client/pull/5

thinkingserious commented 8 years ago

Fixed with: #5