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

Fix API path definitions #292

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kali-hernandez
Copy link

@kali-hernandez kali-hernandez commented Jun 20, 2018

Fixes #291

Declares path for API GET calls using not issue.self (which produces full URIs) but client.options[:rest_base_path]

Resulting API calls will not have repeated URIs which are raising request_client.rb:16:in `request': JIRA::HTTPError

Works For Me (TM)

@kali-hernandez kali-hernandez force-pushed the fix_api_path_definitions branch 5 times, most recently from fc2e8a3 to 7d91995 Compare June 21, 2018 01:28
@kali-hernandez
Copy link
Author

Fixed PR to deal with Travis checks errors on watchers class.
For some reason the watchers endpoint of the API used on the test fails to return the watchers for requests for:

/jira/rest/api/2/issue/SAMPLEPROJECT-1/watchers

but does properly return them for:

/jira/rest/api/2/issue/10002/watchers

so I needed to replace the issue.key by issue.id when bulding the path for the request.

I suspect this is an issue with the Travis check itself as I cannot reproduce it with my Jira installation, and the API clearly states that watchers should be retrievable either by issue ID or Key (see https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/issue-getIssueWatchers : {issueIdOrKey})

Copy link

@KashifSaadat KashifSaadat left a comment

Choose a reason for hiding this comment

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

LG

Fixes sumoheavy#291

Declares `path` for API GET calls using not `issue.self` (which produces full URIs) but `client.options[:rest_base_path]`

Resulting API calls will not have repeated URIs which are raising `request_client.rb:16:in `request': JIRA::HTTPError`

Works For Me (TM)
@kali-hernandez
Copy link
Author

Force-pushed commit to amend author email due to local git misconfiguration

@rmf34
Copy link

rmf34 commented Oct 22, 2018

@kali-hernandez could you add a test for this?

@garciaf
Copy link
Collaborator

garciaf commented Aug 19, 2019

Why you do this only on certain ressources? And not on all? @kali-hernandez

@marlinpierce
Copy link
Contributor

marlinpierce commented Dec 2, 2023

Tests fail for ruby 3.0.6, 3.1.4, and 3.2.2.
Tests fail for activesupport 7.1.2.
On brand master all tests pass under these conditions so you might solve this by merging master into your branch.

[1] JIRA::OauthClient authenticating with oauth the access token initializes

rspec ./spec/jira/oauth_client_spec.rb:59 # JIRA::OauthClient authenticating with oauth the access token initializes


Failure/Error: @access_token = request_token.get_access_token(params)

#<OAuth::RequestToken:0x00007f83955433a8 @token="", @secret="", @consumer=#<OAuth::Consumer:0x00007f839549bdd8 @key="foo", @secret="bar", @options=#<SnakyHash::SymbolKeyed access_token_path="/jira/plugins/servlet/oauth/access-token" auth_type=:oauth authenticate_path="/oauth/authenticate" authorize_path="/jira/plugins/servlet/oauth/authorize" body_hash_enabled=true consumer_key="foo" consumer_secret="bar" context_path="/jira" debug_output=nil http_debug=false http_method=:post oauth_version="1.0" private_key_file="rsakey.pem" proxy=nil request_token_path="/jira/plugins/servlet/oauth/request-token" rest_base_path="/rest/api/2" scheme=:header signature_method="RSA-SHA1" site="http://localhost:2990" ssl_verify_mode=1 use_client_cert=false use_ssl=true>>, @params={}> received :get_access_token with unexpected arguments
expected: ({:oauth_verifier=>"abc123"}) (keyword arguments)
got: ({:oauth_verifier=>"abc123"}) (options hash)
# ./lib/jira/oauth_client.rb:59:in `init_access_token'
# ./spec/jira/oauth_client_spec.rb:64:in `block (4 levels) in <top (required)>'

[2] JIRA::OauthClient authenticating with oauth the access token initializes

rspec ./spec/jira/oauth_client_spec.rb:59 # JIRA::OauthClient authenticating with oauth the access token initializes


Failure/Error: @access_token = request_token.get_access_token(params)

#<OAuth::RequestToken:0x000000010e059330 @token="", @secret="", @consumer=#<OAuth::Consumer:0x000000010e05bfe0 @key="foo", @secret="bar", @options=#<SnakyHash::SymbolKeyed access_token_path="/jira/plugins/servlet/oauth/access-token" auth_type=:oauth authenticate_path="/oauth/authenticate" authorize_path="/jira/plugins/servlet/oauth/authorize" body_hash_enabled=true consumer_key="foo" consumer_secret="bar" context_path="/jira" debug_output=nil http_debug=false http_method=:post oauth_version="1.0" private_key_file="rsakey.pem" proxy=nil request_token_path="/jira/plugins/servlet/oauth/request-token" rest_base_path="/rest/api/2" scheme=:header signature_method="RSA-SHA1" site="http://localhost:2990" ssl_verify_mode=1 use_client_cert=false use_ssl=true>>, @params={}> received :get_access_token with unexpected arguments
expected: ({:oauth_verifier=>"abc123"}) (keyword arguments)
got: ({:oauth_verifier=>"abc123"}) (options hash)
# ./lib/jira/oauth_client.rb:59:in `init_access_token'
# ./spec/jira/oauth_client_spec.rb:64:in `block (4 levels) in <top (required)>'

[3] JIRA::Resource::Filter returns issues

rspec ./spec/jira/resource/filter_spec.rb:85 # JIRA::Resource::Filter returns issues



Failure/Error: expect(filter).to be_present
expected #<JIRA::Resource::Filter:0x000000010dd3b720 @client=#<Double (anonymous)>, @attrs={"id"=>42, "self"=>...123, "type"=>"global"}], "subscriptions"=>{"size"=>0, "items"=>[]}}, @expanded=true, @deleted=false> to respond to `present?`
# ./spec/jira/resource/filter_spec.rb:86:in `block (2 levels) in <top (required)>'

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.

Transition class HTTPError on reading API response
6 participants