Commit afdf9a5e1de08d728af4b0ad3e4d94c4f9a0a04f
Exists in
master
and in
1 other branch
Merge pull request #506 from Gonzih/master
Fix issue with invalid repo user for api call to bitbucket.
Showing
2 changed files
with
5 additions
and
4 deletions
Show diff stats
app/models/issue_trackers/bitbucket_issues_tracker.rb
... | ... | @@ -26,7 +26,9 @@ class IssueTrackers::BitbucketIssuesTracker < IssueTracker |
26 | 26 | bitbucket = BitBucket.new :basic_auth => "#{api_token}:#{project_id}" |
27 | 27 | |
28 | 28 | begin |
29 | - issue = bitbucket.issues.create api_token, repo_name.split('/')[1], :title => issue_title(problem), :content => body_template.result(binding), :priority => 'critical' | |
29 | + r_user = repo_name.split('/')[0] | |
30 | + r_name = repo_name.split('/')[1] | |
31 | + issue = bitbucket.issues.create r_user, r_name, :title => issue_title(problem), :content => body_template.result(binding), :priority => 'critical' | |
30 | 32 | problem.update_attributes( |
31 | 33 | :issue_link => "https://bitbucket.org/#{repo_name}/issue/#{issue.local_id}/", |
32 | 34 | :issue_type => Label | ... | ... |
spec/models/issue_trackers/bitbucket_issues_tracker_spec.rb
... | ... | @@ -26,16 +26,15 @@ describe IssueTrackers::BitbucketIssuesTracker do |
26 | 26 | } |
27 | 27 | EOF |
28 | 28 | |
29 | - stub_request(:post, "https://#{tracker.api_token}:#{tracker.project_id}@bitbucket.org/api/1.0/repositories/test_username/test_repo/issues/").to_return(:status => 200, :headers => {}, :body => body ) | |
29 | + stub_request(:post, "https://#{tracker.api_token}:#{tracker.project_id}@bitbucket.org/api/1.0/repositories/test_user/test_repo/issues/").to_return(:status => 200, :headers => {}, :body => body ) | |
30 | 30 | |
31 | 31 | problem.app.issue_tracker.create_issue(problem) |
32 | 32 | problem.reload |
33 | 33 | |
34 | - requested = have_requested(:post, "https://#{tracker.api_token}:#{tracker.project_id}@bitbucket.org/api/1.0/repositories/test_username/test_repo/issues/") | |
34 | + requested = have_requested(:post, "https://#{tracker.api_token}:#{tracker.project_id}@bitbucket.org/api/1.0/repositories/test_user/test_repo/issues/") | |
35 | 35 | WebMock.should requested.with(:title => /[production][foo#bar] FooError: Too Much Bar/) |
36 | 36 | WebMock.should requested.with(:content => /See this exception on Errbit/) |
37 | 37 | |
38 | 38 | problem.issue_link.should == @issue_link |
39 | 39 | end |
40 | 40 | end |
41 | - | ... | ... |