scm: subversion: change some functional tests project id from 1 to 3.
TODO: remaining tests read fixture. All tests need to read test repository. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4896 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
4b096e9a56
commit
3e463c4e69
|
@ -26,17 +26,26 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
|
||||||
:repositories, :issues, :issue_statuses, :changesets, :changes,
|
:repositories, :issues, :issue_statuses, :changesets, :changes,
|
||||||
:issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
|
:issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
|
||||||
|
|
||||||
|
PRJ_ID = 3
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@controller = RepositoriesController.new
|
@controller = RepositoriesController.new
|
||||||
@request = ActionController::TestRequest.new
|
@request = ActionController::TestRequest.new
|
||||||
@response = ActionController::TestResponse.new
|
@response = ActionController::TestResponse.new
|
||||||
Setting.default_language = 'en'
|
Setting.default_language = 'en'
|
||||||
User.current = nil
|
User.current = nil
|
||||||
|
|
||||||
|
@project = Project.find(PRJ_ID)
|
||||||
|
@repository = Repository::Subversion.create(:project => @project,
|
||||||
|
:url => "file://#{self.class.repository_path('subversion')}")
|
||||||
|
assert @repository
|
||||||
end
|
end
|
||||||
|
|
||||||
if repository_configured?('subversion')
|
if repository_configured?('subversion')
|
||||||
def test_show
|
def test_show
|
||||||
get :show, :id => 1
|
@repository.fetch_changesets
|
||||||
|
@repository.reload
|
||||||
|
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)
|
||||||
|
@ -44,7 +53,9 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_browse_root
|
def test_browse_root
|
||||||
get :show, :id => 1
|
@repository.fetch_changesets
|
||||||
|
@repository.reload
|
||||||
|
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)
|
||||||
|
@ -53,7 +64,9 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_browse_directory
|
def test_browse_directory
|
||||||
get :show, :id => 1, :path => ['subversion_test']
|
@repository.fetch_changesets
|
||||||
|
@repository.reload
|
||||||
|
get :show, :id => PRJ_ID, :path => ['subversion_test']
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'show'
|
assert_template 'show'
|
||||||
assert_not_nil assigns(:entries)
|
assert_not_nil assigns(:entries)
|
||||||
|
@ -65,7 +78,9 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_browse_at_given_revision
|
def test_browse_at_given_revision
|
||||||
get :show, :id => 1, :path => ['subversion_test'], :rev => 4
|
@repository.fetch_changesets
|
||||||
|
@repository.reload
|
||||||
|
get :show, :id => PRJ_ID, :path => ['subversion_test'], :rev => 4
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'show'
|
assert_template 'show'
|
||||||
assert_not_nil assigns(:entries)
|
assert_not_nil assigns(:entries)
|
||||||
|
@ -73,7 +88,9 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_file_changes
|
def test_file_changes
|
||||||
get :changes, :id => 1, :path => ['subversion_test', 'folder', 'helloworld.rb' ]
|
@repository.fetch_changesets
|
||||||
|
@repository.reload
|
||||||
|
get :changes, :id => PRJ_ID, :path => ['subversion_test', 'folder', 'helloworld.rb' ]
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'changes'
|
assert_template 'changes'
|
||||||
|
|
||||||
|
@ -93,7 +110,9 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_directory_changes
|
def test_directory_changes
|
||||||
get :changes, :id => 1, :path => ['subversion_test', 'folder' ]
|
@repository.fetch_changesets
|
||||||
|
@repository.reload
|
||||||
|
get :changes, :id => PRJ_ID, :path => ['subversion_test', 'folder' ]
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'changes'
|
assert_template 'changes'
|
||||||
|
|
||||||
|
@ -103,15 +122,19 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_entry
|
def test_entry
|
||||||
get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c']
|
@repository.fetch_changesets
|
||||||
|
@repository.reload
|
||||||
|
get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c']
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'entry'
|
assert_template 'entry'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_entry_should_send_if_too_big
|
def test_entry_should_send_if_too_big
|
||||||
|
@repository.fetch_changesets
|
||||||
|
@repository.reload
|
||||||
# no files in the test repo is larger than 1KB...
|
# no files in the test repo is larger than 1KB...
|
||||||
with_settings :file_max_size_displayed => 0 do
|
with_settings :file_max_size_displayed => 0 do
|
||||||
get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c']
|
get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c']
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template ''
|
assert_template ''
|
||||||
assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition']
|
assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition']
|
||||||
|
@ -119,7 +142,9 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_entry_at_given_revision
|
def test_entry_at_given_revision
|
||||||
get :entry, :id => 1, :path => ['subversion_test', 'helloworld.rb'], :rev => 2
|
@repository.fetch_changesets
|
||||||
|
@repository.reload
|
||||||
|
get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.rb'], :rev => 2
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'entry'
|
assert_template 'entry'
|
||||||
# this line was removed in r3 and file was moved in r6
|
# this line was removed in r3 and file was moved in r6
|
||||||
|
@ -128,27 +153,36 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_entry_not_found
|
def test_entry_not_found
|
||||||
get :entry, :id => 1, :path => ['subversion_test', 'zzz.c']
|
@repository.fetch_changesets
|
||||||
|
@repository.reload
|
||||||
|
get :entry, :id => PRJ_ID, :path => ['subversion_test', 'zzz.c']
|
||||||
assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
|
assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
|
||||||
:content => /The entry or revision was not found in the repository/
|
:content => /The entry or revision was not found in the repository/
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_entry_download
|
def test_entry_download
|
||||||
get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c'], :format => 'raw'
|
@repository.fetch_changesets
|
||||||
|
@repository.reload
|
||||||
|
get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c'], :format => 'raw'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template ''
|
assert_template ''
|
||||||
assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition']
|
assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition']
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_directory_entry
|
def test_directory_entry
|
||||||
get :entry, :id => 1, :path => ['subversion_test', 'folder']
|
@repository.fetch_changesets
|
||||||
|
@repository.reload
|
||||||
|
get :entry, :id => PRJ_ID, :path => ['subversion_test', 'folder']
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'show'
|
assert_template 'show'
|
||||||
assert_not_nil assigns(:entry)
|
assert_not_nil assigns(:entry)
|
||||||
assert_equal 'folder', assigns(:entry).name
|
assert_equal 'folder', assigns(:entry).name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# TODO: this test needs fixtures.
|
||||||
def test_revision
|
def test_revision
|
||||||
|
@repository.fetch_changesets
|
||||||
|
@repository.reload
|
||||||
get :revision, :id => 1, :rev => 2
|
get :revision, :id => 1, :rev => 2
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'revision'
|
assert_template 'revision'
|
||||||
|
@ -167,25 +201,30 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_invalid_revision
|
def test_invalid_revision
|
||||||
get :revision, :id => 1, :rev => 'something_weird'
|
@repository.fetch_changesets
|
||||||
|
@repository.reload
|
||||||
|
get :revision, :id => PRJ_ID, :rev => 'something_weird'
|
||||||
assert_response 404
|
assert_response 404
|
||||||
assert_error_tag :content => /was not found/
|
assert_error_tag :content => /was not found/
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_invalid_revision_diff
|
def test_invalid_revision_diff
|
||||||
get :diff, :id => 1, :rev => '1', :rev_to => 'something_weird'
|
get :diff, :id => PRJ_ID, :rev => '1', :rev_to => 'something_weird'
|
||||||
assert_response 404
|
assert_response 404
|
||||||
assert_error_tag :content => /was not found/
|
assert_error_tag :content => /was not found/
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_empty_revision
|
def test_empty_revision
|
||||||
|
@repository.fetch_changesets
|
||||||
|
@repository.reload
|
||||||
['', ' ', nil].each do |r|
|
['', ' ', nil].each do |r|
|
||||||
get :revision, :id => 1, :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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# TODO: this test needs fixtures.
|
||||||
def test_revision_with_repository_pointing_to_a_subdirectory
|
def test_revision_with_repository_pointing_to_a_subdirectory
|
||||||
r = Project.find(1).repository
|
r = Project.find(1).repository
|
||||||
# Changes repository url to a subdirectory
|
# Changes repository url to a subdirectory
|
||||||
|
@ -209,7 +248,9 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_revision_diff
|
def test_revision_diff
|
||||||
get :diff, :id => 1, :rev => 3
|
@repository.fetch_changesets
|
||||||
|
@repository.reload
|
||||||
|
get :diff, :id => PRJ_ID, :rev => 3
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'diff'
|
assert_template 'diff'
|
||||||
|
|
||||||
|
@ -217,7 +258,9 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_directory_diff
|
def test_directory_diff
|
||||||
get :diff, :id => 1, :rev => 6, :rev_to => 2, :path => ['subversion_test', 'folder']
|
@repository.fetch_changesets
|
||||||
|
@repository.reload
|
||||||
|
get :diff, :id => PRJ_ID, :rev => 6, :rev_to => 2, :path => ['subversion_test', 'folder']
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'diff'
|
assert_template 'diff'
|
||||||
|
|
||||||
|
@ -230,13 +273,17 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_annotate
|
def test_annotate
|
||||||
get :annotate, :id => 1, :path => ['subversion_test', 'helloworld.c']
|
@repository.fetch_changesets
|
||||||
|
@repository.reload
|
||||||
|
get :annotate, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c']
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'annotate'
|
assert_template 'annotate'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_annotate_at_given_revision
|
def test_annotate_at_given_revision
|
||||||
get :annotate, :id => 1, :rev => 8, :path => ['subversion_test', 'helloworld.c']
|
@repository.fetch_changesets
|
||||||
|
@repository.reload
|
||||||
|
get :annotate, :id => PRJ_ID, :rev => 8, :path => ['subversion_test', 'helloworld.c']
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'annotate'
|
assert_template 'annotate'
|
||||||
assert_tag :tag => 'h2', :content => /@ 8/
|
assert_tag :tag => 'h2', :content => /@ 8/
|
||||||
|
|
Loading…
Reference in New Issue