-
Notifications
You must be signed in to change notification settings - Fork 136
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
Client information headers #31
Changes from 3 commits
80e535f
23698e5
cfebe51
1e5c250
a6e6d9c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,4 +42,28 @@ | |
let(:credentials) { v2_credentials.merge({access_token: ENV["MASTER_JWT"]}) } | ||
end | ||
|
||
context "client headers" do | ||
let(:client) { Auth0::Client.new(v2_credentials.merge({access_token: 'abc123', domain: 'myhost.auth0.com'})) } | ||
let(:headers) { client.class.headers } | ||
|
||
it "has the correct headers present" do | ||
headers.keys.sort.should eql ['Authorization', 'Content-Type', 'User-Agent', 'X-Auth0-Client'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rather use expect syntax instead of should. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unless we use implicit subject.. |
||
end | ||
|
||
it "uses the correct access token" do | ||
headers['Authorization'].should eql "Bearer abc123" | ||
end | ||
|
||
it "is always json" do | ||
headers['Content-Type'] = 'application/json' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you forgot the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
end | ||
|
||
it "sets the ruby version" do | ||
headers['User-Agent'].should eql "Ruby/#{RUBY_VERSION}" | ||
end | ||
|
||
it "sets the client version" do | ||
headers['X-Auth0-Client'].should eql "Ruby/#{Auth0::VERSION}" | ||
end | ||
end | ||
end |
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 think it will better to test this in an unit tests but we can have this here till we re-do them