Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[api] support and test release split (project copy with makeolder). F…
…ix backend to modify right projects
- Loading branch information
1 parent
0557ad6
commit f6c5e68
Showing
3 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
require File.expand_path(File.dirname(__FILE__) + "/..") + "/test_helper" | ||
require 'source_controller' | ||
|
||
class ReleaseManagementTests < ActionController::IntegrationTest | ||
fixtures :all | ||
|
||
def test_release_project | ||
ActionController::IntegrationTest::reset_auth | ||
prepare_request_with_user "tom", "thunder" | ||
|
||
# copy any entire project | ||
post "/source/home:tom:BaseDistro", :cmd => :copy, :oproject => "BaseDistro" | ||
assert_response :success | ||
|
||
# try a split | ||
post "/source/home:tom:BaseDistro", :cmd => :copy, :oproject => "BaseDistro", :makeolder => 1 | ||
assert_response 403 | ||
|
||
#cleanup | ||
delete "/source/home:tom:BaseDistro" | ||
assert_response :success | ||
|
||
get "/source/BaseDistro" | ||
assert_response :success | ||
packages = ActiveXML::XMLNode.new(@response.body) | ||
vrevs = {} | ||
packages.each_entry do |p| | ||
get "/source/BaseDistro/#{p.name}" | ||
assert_response :success | ||
files = ActiveXML::XMLNode.new(@response.body) | ||
vrevs[p.name] = files.vrev | ||
end | ||
assert_not_equal vrevs.count, 0 | ||
|
||
# make a full split as admin | ||
prepare_request_with_user "king", "sunflower" | ||
post "/source/TEST:BaseDistro", :cmd => :copy, :oproject => "BaseDistro", :makeolder => 1, :withhistory => 1 | ||
assert_response :success | ||
|
||
# the origin must got increased by 2 | ||
vrevs.each_key do |k| | ||
get "/source/BaseDistro/#{k}" | ||
assert_response :success | ||
files = ActiveXML::XMLNode.new(@response.body) | ||
assert_equal "#{vrevs[k].to_i+2}", files.vrev | ||
end | ||
|
||
# the copy must have a vrev by one higher and an extended .1 | ||
vrevs.each_key do |k| | ||
get "/source/TEST:BaseDistro/#{k}" | ||
assert_response :success | ||
files = ActiveXML::XMLNode.new(@response.body) | ||
assert_equal "#{vrevs[k].to_i+1}.1", files.vrev | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters