Skip to content
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

Allow passing API key to each request #53

Merged
merged 1 commit into from
Dec 10, 2018

Conversation

nothingisfunny
Copy link
Contributor

No description provided.

lib/checkr.rb Outdated Show resolved Hide resolved
@nothingisfunny nothingisfunny force-pushed the lucya/pass-api-key-to-each-request branch 2 times, most recently from bb16757 to f4c8954 Compare December 10, 2018 19:22
lib/checkr.rb Outdated Show resolved Hide resolved
@nothingisfunny
Copy link
Contributor Author

@jperichon Added tests for get, put, post and delete requests. Api key is preset for all the tests, so these test overriding the one initially set.

@jperichon
Copy link
Member

@nothingisfunny can we add a regression test to ensure that api key is removed from the params? Like this if the removal is removed from the code, tests will break.

@nothingisfunny nothingisfunny force-pushed the lucya/pass-api-key-to-each-request branch from f4c8954 to 6f63c28 Compare December 10, 2018 19:38
@nothingisfunny
Copy link
Contributor Author

nothingisfunny commented Dec 10, 2018

@jperichon These actually already test that. Inside expectation it checks what the params/payload is (I kept the original naming from other tests). I think right now for each request it would check that api_key is not passed as payload/params and also is not added as a query to the url.

@mock.expects(:get).with do |url, headers, params|
(url == "#{Checkr.api_base}#{MockResource.path}?page=1&filter=test%20filter" ||
url == "#{Checkr.api_base}#{MockResource.path}?filter=test%20filter&page=1") &&
params == nil &&
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jperichon Here for example it checks that params are nil, so api_key was removed, and it also checks for the url to not include api_key as a query.

@nothingisfunny nothingisfunny force-pushed the lucya/pass-api-key-to-each-request branch from 6f63c28 to f84fac0 Compare December 10, 2018 19:54
)
end

should 'allow passing an api_key as a param when the global api_key is NOT set' do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@nothingisfunny nothingisfunny force-pushed the lucya/pass-api-key-to-each-request branch from f84fac0 to 7537da0 Compare December 10, 2018 20:38
@nothingisfunny nothingisfunny merged commit 785c99b into master Dec 10, 2018
@nothingisfunny nothingisfunny deleted the lucya/pass-api-key-to-each-request branch December 10, 2018 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants