-
Notifications
You must be signed in to change notification settings - Fork 244
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
Tests #190
Tests #190
Conversation
Can you please break this in to smaller PRs so reviewing it is feasible? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to review this and at such a large size that is hard to do. I would also like to avoid the additional dependency.
go.mod
Outdated
@@ -7,5 +7,6 @@ require ( | |||
github.com/mitchellh/cli v1.0.0 | |||
github.com/mitchellh/go-homedir v1.1.0 | |||
github.com/sirupsen/logrus v1.4.2 | |||
github.com/stretchr/testify v1.2.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to see us stick to the standard library as much as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@theckman , something more like this? Where I use reflect
for the comparison in an if statement.
func TestAbility_ListAbilities(t *testing.T) {
t.Parallel()
setup()
defer teardown()
mux.HandleFunc("/abilities", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
w.Write([]byte(`{"abilities": ["sso"]}`))
})
var client = &Client{apiEndpoint: server.URL, authToken: "foo", HTTPClient: defaultHTTPClient}
want := &ListAbilityResponse{Abilities: []string{"sso"}}
res, err := client.ListAbilities()
if err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(res, want) {
t.Errorf("returned %#v; want %#v", res, want)
}
}
Also, as for the size of the PR, adding testing is no small task. But didn't seem I should do in pieces. In hindsight, might have been smarter to propose a testing style and then go forward.
Hey @theckman. I went ahead and removed the |
Hey @theckman, do you have an idea of when you will you be able to review this? If you don't have the bandwidth, maybe we could tag another reviewer? |
Made the changes requested. Messaged reviewer, and provided time to respond. Please post comments or issues if you see anything amiss with the changes.
@stmcallister sorry for the delay; was gone all of last week for yearly planning. Totally nuked me for the weekend. I'll do a review of this, and direct comments to you to be addressed later. |
This PR adds tests for each of the endpoints, with the exception of events_v2.