Skip to content

Commit

Permalink
Failing tests to demonstrate incorrect URL building
Browse files Browse the repository at this point in the history
Demonstrates bug in #831
  • Loading branch information
pengwynn committed Jan 5, 2017
1 parent 3887fd5 commit dc97ce1
Showing 1 changed file with 48 additions and 6 deletions.
54 changes: 48 additions & 6 deletions spec/octokit/client/authorizations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@
end
end # .authorize_url

describe ".check_application_authorization", :vcr do
it "checks an application authorization" do
describe ".check_application_authorization" do
it "checks an application authorization", :vcr do
authorization = create_app_token

token = @app_client.check_application_authorization(authorization.token)
Expand All @@ -179,10 +179,24 @@
assert_requested :get, url
expect(token.user.login).to eq(test_github_login)
end

it "works in Enterprise mode" do
client = Octokit::Client.new \
:client_id => "abcde12345fghij67890",
:client_secret => "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd",
:api_endpoint => "https://gh-enterprise.com/api/v3"

path = "applications/abcde12345fghij67890/tokens/25f94a2a5c7fbaf499c665bc73d67c1c87e496da8985131633ee0a95819db2e8"

request = stub_get("https://abcde12345fghij67890:abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd@gh-enterprise.com/api/v3/#{path}")
token = client.check_application_authorization("25f94a2a5c7fbaf499c665bc73d67c1c87e496da8985131633ee0a95819db2e8")

assert_requested request
end
end # .check_application_authorization

describe ".reset_application_authorization", :vcr do
it "resets a token" do
describe ".reset_application_authorization" do
it "resets a token", :vcr do
authorization = create_app_token

new_authorization = @app_client.reset_application_authorization authorization.token
Expand All @@ -195,10 +209,24 @@
:login => test_github_client_id, :password => test_github_client_secret
assert_requested :post, reset_url
end

it "works in Enterprise mode" do
client = Octokit::Client.new \
:client_id => "abcde12345fghij67890",
:client_secret => "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd",
:api_endpoint => "https://gh-enterprise.com/api/v3"

path = "applications/abcde12345fghij67890/tokens/25f94a2a5c7fbaf499c665bc73d67c1c87e496da8985131633ee0a95819db2e8"

request = stub_post("https://abcde12345fghij67890:abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd@gh-enterprise.com/api/v3/#{path}")
token = client.reset_application_authorization("25f94a2a5c7fbaf499c665bc73d67c1c87e496da8985131633ee0a95819db2e8")

assert_requested request
end
end # .reset_application_authorization

describe ".revoke_application_authorization", :vcr do
it "deletes an application authorization" do
describe ".revoke_application_authorization" do
it "deletes an application authorization", :vcr do
authorization = create_app_token

result = @app_client.revoke_application_authorization authorization.token
Expand All @@ -209,6 +237,20 @@
:login => test_github_client_id, :password => test_github_client_secret
assert_requested :delete, revoke_url
end

it "works in Enterprise mode" do
client = Octokit::Client.new \
:client_id => "abcde12345fghij67890",
:client_secret => "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd",
:api_endpoint => "https://gh-enterprise.com/api/v3"

path = "applications/abcde12345fghij67890/tokens/25f94a2a5c7fbaf499c665bc73d67c1c87e496da8985131633ee0a95819db2e8"

request = stub_delete("https://abcde12345fghij67890:abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd@gh-enterprise.com/api/v3/#{path}")
token = client.revoke_application_authorization("25f94a2a5c7fbaf499c665bc73d67c1c87e496da8985131633ee0a95819db2e8")

assert_requested request
end
end # .revoke_application_authorization

describe ".revoke_all_application_authorizations" do
Expand Down

0 comments on commit dc97ce1

Please sign in to comment.