scm: git: use constant value for project id in functional test.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5696 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
673fe7f372
commit
02b43944e3
|
@ -27,6 +27,7 @@ class RepositoriesGitControllerTest < ActionController::TestCase
|
||||||
# No '..' in the repository path
|
# No '..' in the repository path
|
||||||
REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/git_repository'
|
REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/git_repository'
|
||||||
REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
|
REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
|
||||||
|
PRJ_ID = 3
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@controller = RepositoriesController.new
|
@controller = RepositoriesController.new
|
||||||
|
@ -45,7 +46,7 @@ class RepositoriesGitControllerTest < ActionController::TestCase
|
||||||
def test_browse_root
|
def test_browse_root
|
||||||
@repository.fetch_changesets
|
@repository.fetch_changesets
|
||||||
@repository.reload
|
@repository.reload
|
||||||
get :show, :id => 3
|
get :show, :id => PRJ_ID
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'show'
|
assert_template 'show'
|
||||||
assert_not_nil assigns(:entries)
|
assert_not_nil assigns(:entries)
|
||||||
|
@ -66,7 +67,7 @@ class RepositoriesGitControllerTest < ActionController::TestCase
|
||||||
def test_browse_branch
|
def test_browse_branch
|
||||||
@repository.fetch_changesets
|
@repository.fetch_changesets
|
||||||
@repository.reload
|
@repository.reload
|
||||||
get :show, :id => 3, :rev => 'test_branch'
|
get :show, :id => PRJ_ID, :rev => 'test_branch'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'show'
|
assert_template 'show'
|
||||||
assert_not_nil assigns(:entries)
|
assert_not_nil assigns(:entries)
|
||||||
|
@ -86,7 +87,7 @@ class RepositoriesGitControllerTest < ActionController::TestCase
|
||||||
"tag00.lightweight",
|
"tag00.lightweight",
|
||||||
"tag01.annotated",
|
"tag01.annotated",
|
||||||
].each do |t1|
|
].each do |t1|
|
||||||
get :show, :id => 3, :rev => t1
|
get :show, :id => PRJ_ID, :rev => t1
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'show'
|
assert_template 'show'
|
||||||
assert_not_nil assigns(:entries)
|
assert_not_nil assigns(:entries)
|
||||||
|
@ -99,7 +100,7 @@ class RepositoriesGitControllerTest < ActionController::TestCase
|
||||||
def test_browse_directory
|
def test_browse_directory
|
||||||
@repository.fetch_changesets
|
@repository.fetch_changesets
|
||||||
@repository.reload
|
@repository.reload
|
||||||
get :show, :id => 3, :path => ['images']
|
get :show, :id => PRJ_ID, :path => ['images']
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'show'
|
assert_template 'show'
|
||||||
assert_not_nil assigns(:entries)
|
assert_not_nil assigns(:entries)
|
||||||
|
@ -115,7 +116,8 @@ class RepositoriesGitControllerTest < ActionController::TestCase
|
||||||
def test_browse_at_given_revision
|
def test_browse_at_given_revision
|
||||||
@repository.fetch_changesets
|
@repository.fetch_changesets
|
||||||
@repository.reload
|
@repository.reload
|
||||||
get :show, :id => 3, :path => ['images'], :rev => '7234cb2750b63f47bff735edc50a1c0a433c2518'
|
get :show, :id => PRJ_ID, :path => ['images'],
|
||||||
|
:rev => '7234cb2750b63f47bff735edc50a1c0a433c2518'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'show'
|
assert_template 'show'
|
||||||
assert_not_nil assigns(:entries)
|
assert_not_nil assigns(:entries)
|
||||||
|
@ -125,14 +127,14 @@ class RepositoriesGitControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_changes
|
def test_changes
|
||||||
get :changes, :id => 3, :path => ['images', 'edit.png']
|
get :changes, :id => PRJ_ID, :path => ['images', 'edit.png']
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'changes'
|
assert_template 'changes'
|
||||||
assert_tag :tag => 'h2', :content => 'edit.png'
|
assert_tag :tag => 'h2', :content => 'edit.png'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_entry_show
|
def test_entry_show
|
||||||
get :entry, :id => 3, :path => ['sources', 'watchers_controller.rb']
|
get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'entry'
|
assert_template 'entry'
|
||||||
# Line 19
|
# Line 19
|
||||||
|
@ -143,14 +145,15 @@ class RepositoriesGitControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_entry_download
|
def test_entry_download
|
||||||
get :entry, :id => 3, :path => ['sources', 'watchers_controller.rb'], :format => 'raw'
|
get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'],
|
||||||
|
:format => 'raw'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
# File content
|
# File content
|
||||||
assert @response.body.include?('WITHOUT ANY WARRANTY')
|
assert @response.body.include?('WITHOUT ANY WARRANTY')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_directory_entry
|
def test_directory_entry
|
||||||
get :entry, :id => 3, :path => ['sources']
|
get :entry, :id => PRJ_ID, :path => ['sources']
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'show'
|
assert_template 'show'
|
||||||
assert_not_nil assigns(:entry)
|
assert_not_nil assigns(:entry)
|
||||||
|
@ -160,9 +163,8 @@ class RepositoriesGitControllerTest < ActionController::TestCase
|
||||||
def test_diff
|
def test_diff
|
||||||
@repository.fetch_changesets
|
@repository.fetch_changesets
|
||||||
@repository.reload
|
@repository.reload
|
||||||
|
|
||||||
# Full diff of changeset 2f9c0091
|
# Full diff of changeset 2f9c0091
|
||||||
get :diff, :id => 3, :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
|
get :diff, :id => PRJ_ID, :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'diff'
|
assert_template 'diff'
|
||||||
# Line 22 removed
|
# Line 22 removed
|
||||||
|
@ -177,19 +179,18 @@ class RepositoriesGitControllerTest < ActionController::TestCase
|
||||||
def test_diff_two_revs
|
def test_diff_two_revs
|
||||||
@repository.fetch_changesets
|
@repository.fetch_changesets
|
||||||
@repository.reload
|
@repository.reload
|
||||||
|
get :diff, :id => PRJ_ID,
|
||||||
get :diff, :id => 3, :rev => '61b685fbe55ab05b5ac68402d5720c1a6ac973d1',
|
:rev => '61b685fbe55ab05b5ac68402d5720c1a6ac973d1',
|
||||||
:rev_to => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
|
:rev_to => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'diff'
|
assert_template 'diff'
|
||||||
|
|
||||||
diff = assigns(:diff)
|
diff = assigns(:diff)
|
||||||
assert_not_nil diff
|
assert_not_nil diff
|
||||||
assert_tag :tag => 'h2', :content => /2f9c0091:61b685fb/
|
assert_tag :tag => 'h2', :content => /2f9c0091:61b685fb/
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_annotate
|
def test_annotate
|
||||||
get :annotate, :id => 3, :path => ['sources', 'watchers_controller.rb']
|
get :annotate, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'annotate'
|
assert_template 'annotate'
|
||||||
# Line 23, changeset 2f9c0091
|
# Line 23, changeset 2f9c0091
|
||||||
|
@ -216,14 +217,15 @@ class RepositoriesGitControllerTest < ActionController::TestCase
|
||||||
def test_annotate_at_given_revision
|
def test_annotate_at_given_revision
|
||||||
@repository.fetch_changesets
|
@repository.fetch_changesets
|
||||||
@repository.reload
|
@repository.reload
|
||||||
get :annotate, :id => 3, :rev => 'deff7', :path => ['sources', 'watchers_controller.rb']
|
get :annotate, :id => PRJ_ID, :rev => 'deff7',
|
||||||
|
:path => ['sources', 'watchers_controller.rb']
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'annotate'
|
assert_template 'annotate'
|
||||||
assert_tag :tag => 'h2', :content => /@ deff712f/
|
assert_tag :tag => 'h2', :content => /@ deff712f/
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_annotate_binary_file
|
def test_annotate_binary_file
|
||||||
get :annotate, :id => 3, :path => ['images', 'edit.png']
|
get :annotate, :id => PRJ_ID, :path => ['images', 'edit.png']
|
||||||
assert_response 500
|
assert_response 500
|
||||||
assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
|
assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
|
||||||
:content => /cannot be annotated/
|
:content => /cannot be annotated/
|
||||||
|
@ -233,7 +235,7 @@ class RepositoriesGitControllerTest < ActionController::TestCase
|
||||||
@repository.fetch_changesets
|
@repository.fetch_changesets
|
||||||
@repository.reload
|
@repository.reload
|
||||||
['61b685fbe55ab05b5ac68402d5720c1a6ac973d1', '61b685f'].each do |r|
|
['61b685fbe55ab05b5ac68402d5720c1a6ac973d1', '61b685f'].each do |r|
|
||||||
get :revision, :id => 3, :rev => r
|
get :revision, :id => PRJ_ID, :rev => r
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'revision'
|
assert_template 'revision'
|
||||||
end
|
end
|
||||||
|
@ -243,7 +245,7 @@ class RepositoriesGitControllerTest < ActionController::TestCase
|
||||||
@repository.fetch_changesets
|
@repository.fetch_changesets
|
||||||
@repository.reload
|
@repository.reload
|
||||||
['', ' ', nil].each do |r|
|
['', ' ', nil].each do |r|
|
||||||
get :revision, :id => 3, :rev => r
|
get :revision, :id => PRJ_ID, :rev => r
|
||||||
assert_response 404
|
assert_response 404
|
||||||
assert_error_tag :content => /was not found/
|
assert_error_tag :content => /was not found/
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue