Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add tests for some callback handler error conditions#1510

Merged
srenatus merged 1 commit into
dexidp:masterfrom
momokatte:test-invalid-callbacks
Aug 6, 2019
Merged

Add tests for some callback handler error conditions#1510
srenatus merged 1 commit into
dexidp:masterfrom
momokatte:test-invalid-callbacks

Conversation

@momokatte
Copy link
Copy Markdown
Contributor

Exercises some validation logic in the callback handler

Copy link
Copy Markdown
Contributor

@srenatus srenatus left a comment

Choose a reason for hiding this comment

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

Thanks for adding these! 👏 Some comments inline 👇

Comment thread server/handlers_test.go Outdated
Comment thread server/handlers_test.go Outdated
@momokatte momokatte force-pushed the test-invalid-callbacks branch from 09dfa2b to 43d1a04 Compare August 5, 2019 23:02
@momokatte
Copy link
Copy Markdown
Contributor Author

amended commit with the suggested changes

Copy link
Copy Markdown
Contributor

@srenatus srenatus left a comment

Choose a reason for hiding this comment

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

👍 Thank you!

Comment thread server/handlers_test.go
for i, r := range tests {
server.ServeHTTP(rr, httptest.NewRequest("GET", r.TargetURI, nil))
if rr.Code != r.ExpectedCode {
t.Fatalf("test %d expected %d, got %d", i, r.ExpectedCode, rr.Code)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok, this is nitpicking, but we don't have to use Fatal here -- if one fails, the following ones could still be tested.
Also, if you use t.Run("test name or number", func (t *testing) { /* test body */ }), you can use t.Fatal inside the subtest without failing the entire test.

At any rate this is better than what we have right now, so let's get this merged, and extend on it as needed. 😃

@srenatus srenatus merged commit bc02006 into dexidp:master Aug 6, 2019
mmrath pushed a commit to mmrath/dex that referenced this pull request Sep 2, 2019
Add tests for some callback handler error conditions
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.

2 participants