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

Unit tests #15

Merged
merged 4 commits into from
Jul 19, 2020
Merged

Unit tests #15

merged 4 commits into from
Jul 19, 2020

Conversation

rockspore
Copy link
Contributor

Resolves #3

The coverage will certainly change as the cli evolves. At least for now it is at 80%, ;-)

@codecov
Copy link

codecov bot commented Jul 18, 2020

Codecov Report

Merging #15 into master will increase coverage by 4.71%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #15      +/-   ##
==========================================
+ Coverage   75.28%   80.00%   +4.71%     
==========================================
  Files           6        6              
  Lines         963      955       -8     
==========================================
+ Hits          725      764      +39     
+ Misses        126      101      -25     
+ Partials      112       90      -22     
Impacted Files Coverage Δ
cmd/provision/legacy.go 73.22% <100.00%> (+12.76%) ⬆️
cmd/provision/provision.go 81.49% <100.00%> (+3.79%) ⬆️
cmd/provision/proxy.go 68.42% <0.00%> (+5.26%) ⬆️
cmd/token/token.go 88.46% <0.00%> (+5.76%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1c90b0f...3944297. Read the comment docs.

@rockspore rockspore requested a review from theganyo July 18, 2020 00:54
@rockspore rockspore marked this pull request as ready for review July 18, 2020 00:54
if resp.StatusCode > 299 {
return nil, fmt.Errorf("creating credential, status: %d", resp.StatusCode)
}
// if resp.StatusCode > 299 {
Copy link
Member

Choose a reason for hiding this comment

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

If we don’t need this, we should remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure I will remove it. ApigeeClient explicitly checks the status code and return error on non-2XX codes.

res, err = client.Do(req)
if res != nil {
defer res.Body.Close()
}
}
if err != nil {
if res.StatusCode > 299 || err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Do we know for certain that res will not be 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.

Good point. Will add the null check.

@theganyo theganyo merged commit bf62748 into master Jul 19, 2020
@theganyo
Copy link
Member

Thanks!

@theganyo theganyo deleted the unit-tests branch July 19, 2020 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve unit test code coverage
2 participants