Skip to content

Commit

Permalink
[api] add test case for validating for allow_user_to_create_home_proj…
Browse files Browse the repository at this point in the history
…ect config option
  • Loading branch information
adrianschroeter committed Jun 20, 2013
1 parent adfb481 commit b6c84d0
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/api/test/functional/source_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2559,6 +2559,42 @@ def test_delete_and_undelete_permissions
assert_response :success
end

def test_branch_creating_project
prepare_request_with_user "fredlibs", "geröllheimer"
# ensure he has no home project
get "/source/home:fredlibs"
assert_response 404

# Create public project, but api config is changed to make it closed
CONFIG['allow_user_to_create_home_project'] = false
post "/source/home:Iggy/TestPack", :cmd => :branch, :dryrun => "1"
assert_response :success
post "/source/home:Iggy/TestPack", :cmd => :branch
assert_response 403

# create home and try again
prepare_request_with_user "king", "sunflower"
put "/source/home:fredlibs/_meta", "<project name='home:fredlibs'><title/><description/> <person role='maintainer' userid='fredlibs'/> </project>"
assert_response :success

prepare_request_with_user "fredlibs", "geröllheimer"
post "/source/home:Iggy/TestPack", :cmd => :branch
assert_response :success

# cleanup and try again with defaults
CONFIG['allow_user_to_create_home_project'] = true
delete "/source/home:fredlibs:branches:home:Iggy"
assert_response :success
delete "/source/home:fredlibs"
assert_response :success
post "/source/home:Iggy/TestPack", :cmd => :branch
assert_response :success

# final cleanup
delete "/source/home:fredlibs:branches:home:Iggy"
assert_response :success
end

def test_branch_package_delete_and_undelete
post "/source/home:Iggy/TestPack", :cmd => :branch, :target_project => "home:coolo:test"
assert_response 401
Expand Down

0 comments on commit b6c84d0

Please sign in to comment.