Skip to content

Commit

Permalink
[ci] Fix stub_requests url to have ordered params
Browse files Browse the repository at this point in the history
  • Loading branch information
Moises Deniz Aleman committed Sep 29, 2017
1 parent a8fbda4 commit 0e9bcb3
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
before do
Rails.cache.clear
# NOTE: we're not using VCR here because the backend does not have the obs signer setup by default
keyinfo_url = "#{CONFIG['source_url']}/source/#{CGI.escape(project.name)}/_keyinfo?withsslcert=1&donotcreatecert=1"
keyinfo_url = "#{CONFIG['source_url']}/source/#{CGI.escape(project.name)}/_keyinfo?donotcreatecert=1&withsslcert=1"
stub_request(:get, keyinfo_url).and_return(body: keyinfo_response)

login(user)
Expand Down
16 changes: 8 additions & 8 deletions src/api/spec/controllers/webui/package_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,8 @@ def remove_file_post

context "successfully" do
before do
path = "#{CONFIG['source_url']}/build/#{user.home_project}/_result?view=status" \
"&package=#{source_package}&arch=i586&repository=#{repo_leap_42_2}"
path = "#{CONFIG['source_url']}/build/#{user.home_project}/_result?arch=i586" \
"&package=#{source_package}&repository=#{repo_leap_42_2}&view=status"
stub_request(:get, path).and_return(body:
%(<resultlist state='123'>
<result project='#{user.home_project}' repository='#{repo_leap_42_2}' arch='i586'>
Expand All @@ -847,8 +847,8 @@ def remove_file_post

context "successfully with a package which name that includes '+'" do
before do
path = "#{CONFIG['source_url']}/build/#{user.home_project}/_result?view=status" \
"&package=#{source_package_with_plus}&arch=i586&repository=#{repo_leap_42_2}"
path = "#{CONFIG['source_url']}/build/#{user.home_project}/_result?arch=i586" \
"&package=#{source_package_with_plus}&repository=#{repo_leap_42_2}&view=status"
stub_request(:get, path).and_return(body:
%(<resultlist state='123'>
<result project='#{user.home_project}' repository='#{repo_leap_42_2}' arch='i586'>
Expand All @@ -868,8 +868,8 @@ def remove_file_post
repo_leap_45_1
source_project_with_plus.store

path = "#{CONFIG['source_url']}/build/#{source_project_with_plus}/_result?view=status" \
"&package=#{package_of_project_with_plus}&arch=i586&repository=#{repo_leap_45_1}"
path = "#{CONFIG['source_url']}/build/#{source_project_with_plus}/_result?arch=i586" \
"&package=#{package_of_project_with_plus}&repository=#{repo_leap_45_1}&view=status"
stub_request(:get, path).and_return(body:
%(<resultlist state='123'>
<result project='#{source_project_with_plus}' repository='#{repo_leap_45_1}' arch='i586'>
Expand Down Expand Up @@ -948,8 +948,8 @@ def do_request(params)
let(:starttime) { 1.hour.ago.to_i }

before do
path = "#{CONFIG['source_url']}/build/#{source_project}/_result?view=status" \
"&package=#{source_package}:multibuild-package&arch=i586&repository=#{repo_leap_42_2}"
path = "#{CONFIG['source_url']}/build/#{source_project}/_result?arch=i586" \
"&package=#{source_package}:multibuild-package&repository=#{repo_leap_42_2}&view=status"
stub_request(:get, path).and_return(body: %(<resultlist state='123'>
<result project='#{source_project}' repository='#{repo_leap_42_2}' arch='i586' code="unpublished" state="unpublished">
<status package="#{source_package}:multibuild-package" code="succeeded" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
before do
login(user)
repo_for_source_project
path = "#{CONFIG['source_url']}/build/#{user.home_project}/#{repo_for_source_project.name}/i586/_jobhistory?package=#{package}&limit=100"
path = "#{CONFIG['source_url']}/build/#{user.home_project}/#{repo_for_source_project.name}/i586/_jobhistory?limit=100&package=#{package}"
stub_request(:get, path).and_return(body:
%(<jobhistlist>
<jobhist package='#{package.name}' rev='1' srcmd5='2ac8bd685591b40e412ee99b182f94c2' versrel='7-3' bcnt='1' readytime='1492687344'
Expand Down
2 changes: 1 addition & 1 deletion src/api/spec/controllers/webui/project_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@

let(:jobs_url) do
# FIXME: Hardcoding urls in test doesn't sound like a good idea
"http://backend:5352/build/#{user.home_project.name}/#{repo_for_user_home.name}/x86_64/_jobhistory?limit=0&code=succeeded&code=unchanged"
"http://backend:5352/build/#{user.home_project.name}/#{repo_for_user_home.name}/x86_64/_jobhistory?code=succeeded&code=unchanged&limit=0"
end
let(:jobs_xml) do
<<-XML
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
before do
Rails.cache.clear
# NOTE: we're not using VCR here because the backend does not have the obs signer setup by default
keyinfo_url = "#{CONFIG['source_url']}/source/#{CGI.escape(project.name)}/_keyinfo?withsslcert=1&donotcreatecert=1"
keyinfo_url = "#{CONFIG['source_url']}/source/#{CGI.escape(project.name)}/_keyinfo?donotcreatecert=1&withsslcert=1"
stub_request(:get, keyinfo_url).and_return(body: keyinfo_response)

get :show, params: { project_name: project.name }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
before do
Rails.cache.clear
# NOTE: we're not using VCR here because the backend does not have the obs signer setup by default
keyinfo_url = "#{CONFIG['source_url']}/source/#{CGI.escape(project.name)}/_keyinfo?withsslcert=1&donotcreatecert=1"
keyinfo_url = "#{CONFIG['source_url']}/source/#{CGI.escape(project.name)}/_keyinfo?donotcreatecert=1&withsslcert=1"
stub_request(:get, keyinfo_url).and_return(body: keyinfo_response)

get :show, params: { project_name: project.name }
Expand Down
10 changes: 5 additions & 5 deletions src/api/spec/features/webui/packages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@

before do
login(user)
path = "#{CONFIG['source_url']}/build/#{user.home_project}/_result?view=status&package=#{package}&arch=x86_64&repository=#{repository.name}"
path = "#{CONFIG['source_url']}/build/#{user.home_project}/_result?arch=x86_64&package=#{package}&repository=#{repository.name}&view=status"
stub_request(:get, path).and_return(body: fake_buildresult)
path = "#{CONFIG['source_url']}/build/#{user.home_project}/#{repository.name}/x86_64/_builddepinfo?package=#{package}&view=revpkgnames"
stub_request(:get, path).and_return(body: '<builddepinfo />')
Expand Down Expand Up @@ -182,18 +182,18 @@

before do
login(user)
stub_request(:get, "#{CONFIG['source_url']}/build/#{user.home_project}/#{repository.name}/i586/#{package}/_log?nostream=1&start=0&end=65536")
stub_request(:get, "#{CONFIG['source_url']}/build/#{user.home_project}/#{repository.name}/i586/#{package}/_log?end=65536&nostream=1&start=0")
.and_return(body: '[1] this is my dummy logfile -> ümlaut')
result = %(<resultlist state="8da2ae1e32481175f43dc30b811ad9b5">
<result project="#{user.home_project}" repository="#{repository.name}" arch="i586" code="published" state="published">
<status package="#{package}" code="succeeded" />
</result>
</resultlist>
)
result_path = "#{CONFIG['source_url']}/build/#{user.home_project}/_result?view=status&package=#{package}"
stub_request(:get, result_path + '&multibuild=1&locallink=1')
result_path = "#{CONFIG['source_url']}/build/#{user.home_project}/_result?"
stub_request(:get, result_path + 'view=status&package=test_package&multibuild=1&locallink=1')
.and_return(body: result)
stub_request(:get, result_path + "&arch=i586&repository=#{repository.name}")
stub_request(:get, result_path + "arch=i586&package=#{package}&repository=#{repository.name}&view=status")
.and_return(body: result)
stub_request(:get, "#{CONFIG['source_url']}/build/#{user.home_project}/#{repository.name}/i586/#{package}/_log?view=entry")
.and_return(headers: {'Content-Type'=> 'text/plain'}, body: '<directory><entry size="1"/></directory>')
Expand Down
4 changes: 2 additions & 2 deletions src/api/spec/mixins/build_log_support_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
end

before do
path = "#{CONFIG['source_url']}/build/project_1/repository_1/architecture_1/package_1/_log?nostream=1&start=0&end=65536"
path = "#{CONFIG['source_url']}/build/project_1/repository_1/architecture_1/package_1/_log?end=65536&nostream=1&start=0"
stub_request(:get, path).and_return(body: build_log)
end

Expand Down Expand Up @@ -81,7 +81,7 @@
end

describe '#get_status' do
let(:path) { "#{CONFIG['source_url']}/build/project_1/_result?view=status&package=package_1&arch=architecture_1&repository=repository_1" }
let(:path) { "#{CONFIG['source_url']}/build/project_1/_result?arch=architecture_1&package=package_1&repository=repository_1&view=status" }

subject { instance_with_build_log_support.get_status('project_1', 'package_1', 'repository_1', 'architecture_1') }

Expand Down
4 changes: 2 additions & 2 deletions src/api/spec/models/package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@

describe '#backend_build_command' do
let(:params) { ActionController::Parameters.new(arch: 'x86') }
let(:backend_url) { "#{CONFIG['source_url']}/build/#{package.project.name}?cmd=rebuild&arch=x86" }
let(:backend_url) { "#{CONFIG['source_url']}/build/#{package.project.name}?arch=x86&cmd=rebuild" }

subject { package.backend_build_command(:rebuild, package.project.name, params) }

Expand Down Expand Up @@ -470,7 +470,7 @@
end

describe '#jobhistory_list' do
let(:backend_url) { "#{CONFIG['source_url']}/build/#{home_project}/openSUSE_Tumbleweed/x86_64/_jobhistory?package=#{package}&limit=100" }
let(:backend_url) { "#{CONFIG['source_url']}/build/#{home_project}/openSUSE_Tumbleweed/x86_64/_jobhistory?limit=100&package=#{package}" }

subject { package.jobhistory_list(home_project, 'openSUSE_Tumbleweed', 'x86_64') }

Expand Down

0 comments on commit 0e9bcb3

Please sign in to comment.