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

Externalize parsing of access token response #79

Merged
merged 1 commit into from
May 6, 2016
Merged

Externalize parsing of access token response #79

merged 1 commit into from
May 6, 2016

Conversation

poislagarde
Copy link
Contributor

Closes #76

@bckr bckr self-assigned this Apr 22, 2016
@@ -544,6 +662,8 @@ class HeimdallrSpec: QuickSpec {
}, withStubResponse: { request in
return OHHTTPStubsResponse(data: NSData(contentsOfFile: self.bundle.pathForResource("request-valid", ofType: "json")!)!, statusCode: 200, headers: [ "Content-Type": "application/json" ])
})

accessTokenParser.reset()
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need the reset here? If I comment this line out, the test still succeeds.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bckr: the test succeeds because the first request (that returns an expired access token) already triggered the flag. The reset is there to ensure that the parser is called a second time with the second request. If this is too fragile I can change the flag for a counter.

Copy link
Contributor

@bckr bckr Apr 27, 2016

Choose a reason for hiding this comment

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

Yeah, I think the current way doesn't really verify that it is only called once for the initial request. I think a counter would work here. We could also think about introducing Dobby here for recording the invocations. What do you think @hffmnn?

Update: If you want to have a look at Dobby for simple invocation recording, feel free to add it as a dependency and try it out. I would also be fine with a counter 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great! I'll update the PR ASAP!

@bckr
Copy link
Contributor

bckr commented Apr 27, 2016

@poislagarde Thank you very much for the quick pull request 🎉

At a first glance I would say that this seams like a good approach of externalising the access token parsing. I've made a few notes on code that might need a bit of fine tuning. Maybe one of the other team members want to have a look at this as well.

@poislagarde
Copy link
Contributor Author

Hey @bckr, I answered to your notes. Let me know if you want me to make those changes or not. Thanks!

@poislagarde
Copy link
Contributor Author

Sorry for the delay. I pushed and squashed the changes we talked about. Let me know if you need me to change something else.

@bckr
Copy link
Contributor

bckr commented May 6, 2016

@poislagarde Nice work! I think we can merge this 🚀

@bckr bckr merged commit 4382e51 into trivago:master May 6, 2016
@tibr tibr unassigned bckr Jul 20, 2016
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.

3 participants