##// END OF EJS Templates
Speeds up rendering of the project list for users who belong to hundreds of projects....
Speeds up rendering of the project list for users who belong to hundreds of projects. git-svn-id: http://svn.redmine.org/redmine/trunk@16123 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r15343:00f709ad4d5f
r15741:f8df935dcada
Show More
repositories_mercurial_controller_test.rb
486 lines | 16.6 KiB | text/x-ruby | RubyLexer
/ test / functional / repositories_mercurial_controller_test.rb
Toshi MARUYAMA
scm: mercurial: remove trailing white-spaces and a empty line from functional test....
r5563 # Redmine - project management software
Jean-Philippe Lang
Updates copyright for 2016....
r14856 # Copyright (C) 2006-2016 Jean-Philippe Lang
Jean-Philippe Lang
Added a Mercurial test repository with unit and functional tests....
r978 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
Toshi MARUYAMA
scm: mercurial: remove trailing white-spaces and a empty line from functional test....
r5563 #
Jean-Philippe Lang
Added a Mercurial test repository with unit and functional tests....
r978 # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Toshi MARUYAMA
scm: mercurial: remove trailing white-spaces and a empty line from functional test....
r5563 #
Jean-Philippe Lang
Added a Mercurial test repository with unit and functional tests....
r978 # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Jean-Baptiste Barth
Use absolute paths in test/**/* requires for Ruby 1.9.2 compatibility. #4050...
r4395 require File.expand_path('../../test_helper', __FILE__)
Jean-Philippe Lang
Added a Mercurial test repository with unit and functional tests....
r978
Jean-Philippe Lang
Adds our own class for controller tests....
r15279 class RepositoriesMercurialControllerTest < Redmine::ControllerTest
Jean-Philippe Lang
Test for repository edit and cleanup....
r7929 tests RepositoriesController
Jean-Philippe Lang
Add support for multiple email addresses per user (#4244)....
r13504 fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles,
Toshi MARUYAMA
scm: mercurial: replace RAILS_ROOT to Rails.root in functional test....
r5932 :repositories, :enabled_modules
Jean-Philippe Lang
Added a Mercurial test repository with unit and functional tests....
r978
Toshi MARUYAMA
scm: mercurial: replace RAILS_ROOT to Rails.root in functional test....
r5932 REPOSITORY_PATH = Rails.root.join('tmp/test/mercurial_repository').to_s
Toshi MARUYAMA
scm: mercurial: add path encoding tests in functional test (#2664, #4050)....
r4880 CHAR_1_HEX = "\xc3\x9c"
Toshi MARUYAMA
scm: mercurial: code clean up functional test....
r5566 PRJ_ID = 3
Toshi MARUYAMA
scm: mercurial: add one "closed" branch to test repository (#16177)...
r12654 NUM_REV = 34
Toshi MARUYAMA
scm: mercurial: use constant for project id in functional test....
r5081
Jean-Philippe Lang
Merged rails-4.1 branch (#14534)....
r13100 ruby19_non_utf8_pass = Encoding.default_external.to_s != 'UTF-8'
Jean-Philippe Lang
Added a Mercurial test repository with unit and functional tests....
r978
def setup
User.current = nil
Toshi MARUYAMA
scm: mercurial: add instance variable @project at functional test....
r6122 @project = Project.find(PRJ_ID)
Toshi MARUYAMA
scm: mercurial: update test repository for path encoding (#2664)....
r4876 @repository = Repository::Mercurial.create(
Toshi MARUYAMA
scm: mercurial: add instance variable @project at functional test....
r6122 :project => @project,
Toshi MARUYAMA
scm: mercurial: update test repository for path encoding (#2664)....
r4876 :url => REPOSITORY_PATH,
:path_encoding => 'ISO-8859-1'
)
Toshi MARUYAMA
scm: mercurial: diff '-c' option supports above Mercurial 1.2 (#3724, #7253)....
r4566 assert @repository
Toshi MARUYAMA
scm: mercurial: set instance value flag of whether "hg diff -c" supports true at tests (#7518)....
r4735 @diff_c_support = true
Jean-Philippe Lang
Merged rails-4.1 branch (#14534)....
r13100 @char_1 = CHAR_1_HEX.dup.force_encoding('UTF-8')
@tag_char_1 = "tag-#{CHAR_1_HEX}-00".force_encoding('UTF-8')
@branch_char_0 = "branch-#{CHAR_1_HEX}-00".force_encoding('UTF-8')
@branch_char_1 = "branch-#{CHAR_1_HEX}-01".force_encoding('UTF-8')
Jean-Philippe Lang
Added a Mercurial test repository with unit and functional tests....
r978 end
Toshi MARUYAMA
scm: mercurial: diff '-c' option supports above Mercurial 1.2 (#3724, #7253)....
r4566
Toshi MARUYAMA
scm: mercurial: add path encoding tests in functional test (#2664, #4050)....
r4880 if ruby19_non_utf8_pass
Jean-Philippe Lang
Merged rails-4.1 branch (#14534)....
r13100 puts "TODO: Mercurial functional test fails " +
"when Encoding.default_external is not UTF-8. " +
Toshi MARUYAMA
scm: mercurial: remove trailing white-spaces and a empty line from functional test....
r5563 "Current value is '#{Encoding.default_external.to_s}'"
Toshi MARUYAMA
scm: mercurial: add path encoding tests in functional test (#2664, #4050)....
r4880 def test_fake; assert true end
elsif File.directory?(REPOSITORY_PATH)
Jean-Philippe Lang
Test for repository edit and cleanup....
r7929
Jean-Philippe Lang
Resourcified repositories for CRUD operations to prepare for multiple SCM per project (#779)....
r8528 def test_get_new
Jean-Philippe Lang
Test for repository edit and cleanup....
r7929 @request.session[:user_id] = 1
@project.repository.destroy
Jean-Philippe Lang
Resourcified repositories for CRUD operations to prepare for multiple SCM per project (#779)....
r8528 get :new, :project_id => 'subproject1', :repository_scm => 'Mercurial'
Jean-Philippe Lang
Test for repository edit and cleanup....
r7929 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15343 assert_select 'select[name=?]', 'repository_scm' do
assert_select 'option[value=?][selected=selected]', 'Mercurial'
end
Jean-Philippe Lang
Test for repository edit and cleanup....
r7929 end
Eric Davis
Added branch and tag support to the git repository viewer. (#1406)...
r2735 def test_show_root
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_show_root at functional test...
r7007 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: check changesets size is greater than 0 in browse test in functional test....
r5002 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_show_root at functional test...
r7007 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: use constant for project id in functional test....
r5081 get :show, :id => PRJ_ID
Jean-Philippe Lang
Do not run Mercurial functional tests if the test repository is not set up....
r1006 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15343
assert_select 'table.entries tbody' do
assert_select 'tr', 4
assert_select 'tr.dir td.filename a', :text => 'images'
assert_select 'tr.dir td.filename a', :text => 'sources'
assert_select 'tr.file td.filename a', :text => '.hgtags'
assert_select 'tr.file td.filename a', :text => 'README'
end
assert_select 'table.changesets tbody' do
assert_select 'tr'
end
Jean-Philippe Lang
Do not run Mercurial functional tests if the test repository is not set up....
r1006 end
Toshi MARUYAMA
scm: mercurial: fix revision at functional diff test....
r4598
Eric Davis
Added branch and tag support to the git repository viewer. (#1406)...
r2735 def test_show_directory
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_show_directory at functional test...
r7008 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: check changesets size is greater than 0 in browse test in functional test....
r5002 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_show_directory at functional test...
r7008 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
Rails3: test: scm: mercurial: use "repository_path_hash" for path param...
r8816 get :show, :id => PRJ_ID, :path => repository_path_hash(['images'])[:param]
Jean-Philippe Lang
Do not run Mercurial functional tests if the test repository is not set up....
r1006 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15343
assert_select 'table.entries tbody' do
assert_select 'tr', 2
assert_select 'tr.file td.filename a', :text => 'delete.png'
assert_select 'tr.file td.filename a', :text => 'edit.png'
end
assert_select 'table.changesets tbody' do
assert_select 'tr'
end
Jean-Philippe Lang
Do not run Mercurial functional tests if the test repository is not set up....
r1006 end
Toshi MARUYAMA
scm: mercurial: functional test for accept both of revision number and changeset id (#3724)....
r4544
Eric Davis
Added branch and tag support to the git repository viewer. (#1406)...
r2735 def test_show_at_given_revision
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_show_at_given_revision at functional test...
r7009 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: check changesets size is greater than 0 in browse test in functional test....
r5002 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_show_at_given_revision at functional test...
r7009 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: functional test for accept both of revision number and changeset id (#3724)....
r4544 [0, '0', '0885933ad4f6'].each do |r1|
Toshi MARUYAMA
Rails3: test: scm: mercurial: use "repository_path_hash" for path param...
r8816 get :show, :id => PRJ_ID, :path => repository_path_hash(['images'])[:param],
:rev => r1
Toshi MARUYAMA
scm: mercurial: functional test for accept both of revision number and changeset id (#3724)....
r4544 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15343
assert_select 'table.entries tbody' do
assert_select 'tr', 1
assert_select 'tr.file td.filename a', :text => 'delete.png'
end
assert_select 'table.changesets tbody' do
assert_select 'tr'
end
Toshi MARUYAMA
scm: mercurial: functional test for accept both of revision number and changeset id (#3724)....
r4544 end
Jean-Philippe Lang
Fix repository browsing at given revision for various scm and add tests for this....
r1314 end
Toshi MARUYAMA
scm: mercurial: add some tests at unit and functional test....
r4515
def test_show_directory_sql_escape_percent
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_show_directory_sql_escape_percent at functional test...
r7087 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: check changesets size is greater than 0 in browse test in functional test....
r5002 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_show_directory_sql_escape_percent at functional test...
r7087 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: functional test for accept both of revision number and changeset id (#3724)....
r4544 [13, '13', '3a330eb32958'].each do |r1|
Toshi MARUYAMA
Rails3: test: scm: mercurial: use "repository_path_hash" for path param...
r8816 get :show, :id => PRJ_ID,
:path => repository_path_hash(['sql_escape', 'percent%dir'])[:param],
Toshi MARUYAMA
scm: mercurial: code clean up functional test....
r5566 :rev => r1
Toshi MARUYAMA
scm: mercurial: functional test for accept both of revision number and changeset id (#3724)....
r4544 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15343
assert_select 'table.entries tbody' do
assert_select 'tr', 2
assert_select 'tr.file td.filename a', :text => 'percent%file1.txt'
assert_select 'tr.file td.filename a', :text => 'percentfile1.txt'
end
assert_select 'table.changesets tbody' do
assert_select 'tr td.id a', :text => /^13:/
assert_select 'tr td.id a', :text => /^11:/
assert_select 'tr td.id a', :text => /^10:/
assert_select 'tr td.id a', :text => /^9:/
end
Toshi MARUYAMA
scm: mercurial: functional test for accept both of revision number and changeset id (#3724)....
r4544 end
Toshi MARUYAMA
scm: mercurial: add some tests at unit and functional test....
r4515 end
Toshi MARUYAMA
scm: mercurial: change Latin-1 path test methods name....
r5565 def test_show_directory_latin_1_path
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_show_directory_latin_1_path at functional test...
r7088 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: add path encoding tests in functional test (#2664, #4050)....
r4880 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_show_directory_latin_1_path at functional test...
r7088 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: add path encoding tests in functional test (#2664, #4050)....
r4880 [21, '21', 'adf805632193'].each do |r1|
Toshi MARUYAMA
Rails3: test: scm: mercurial: use "repository_path_hash" for path param...
r8816 get :show, :id => PRJ_ID,
:path => repository_path_hash(['latin-1-dir'])[:param],
:rev => r1
Toshi MARUYAMA
scm: mercurial: add path encoding tests in functional test (#2664, #4050)....
r4880 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15343
assert_select 'table.entries tbody' do
assert_select 'tr', 4
assert_select 'tr.file td.filename a', :text => "make-latin-1-file.rb"
assert_select 'tr.file td.filename a', :text => "test-#{@char_1}-1.txt"
assert_select 'tr.file td.filename a', :text => "test-#{@char_1}-2.txt"
assert_select 'tr.file td.filename a', :text => "test-#{@char_1}.txt"
end
assert_select 'table.changesets tbody' do
assert_select 'tr td.id a', :text => /^21:/
assert_select 'tr td.id a', :text => /^20:/
assert_select 'tr td.id a', :text => /^19:/
assert_select 'tr td.id a', :text => /^18:/
assert_select 'tr td.id a', :text => /^17:/
end
Toshi MARUYAMA
scm: mercurial: add path encoding tests in functional test (#2664, #4050)....
r4880 end
end
Jean-Philippe Lang
Fixed: Git: Mercurial: Branch dropdown broken on repositories page (#10026)....
r8558 def show_should_show_branch_selection_form
@repository.fetch_changesets
@project.reload
get :show, :id => PRJ_ID
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'form#revision_selector[action=?]', '/projects/subproject1/repository/show' do
assert_select 'select[name=branch]' do
assert_select 'option[value=?]', 'test-branch-01'
end
end
Jean-Philippe Lang
Fixed: Git: Mercurial: Branch dropdown broken on repositories page (#10026)....
r8558 end
Toshi MARUYAMA
scm: mercurial: add named branch test in functional test (#7246)....
r5010 def test_show_branch
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_show_branch at functional test...
r7089 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: add named branch test in functional test (#7246)....
r5010 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_show_branch at functional test...
r7089 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: add named branch test in functional test (#7246)....
r5010 [
'default',
@branch_char_1,
'branch (1)[2]&,%.-3_4',
@branch_char_0,
'test_branch.latin-1',
'test-branch-00',
].each do |bra|
Toshi MARUYAMA
scm: mercurial: use constant for project id in functional test....
r5081 get :show, :id => PRJ_ID, :rev => bra
Toshi MARUYAMA
scm: mercurial: add named branch test in functional test (#7246)....
r5010 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15343
assert_select 'table.entries tbody tr'
assert_select 'table.changesets tbody tr'
Toshi MARUYAMA
scm: mercurial: add named branch test in functional test (#7246)....
r5010 end
end
Toshi MARUYAMA
scm: mercurial: add tag test in functional test (#1981)....
r5011 def test_show_tag
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_show_tag at functional test...
r7090 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: add tag test in functional test (#1981)....
r5011 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_show_tag at functional test...
r7090 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: add tag test in functional test (#1981)....
r5011 [
@tag_char_1,
'tag_test.00',
'tag-init-revision'
].each do |tag|
Toshi MARUYAMA
scm: mercurial: use constant for project id in functional test....
r5081 get :show, :id => PRJ_ID, :rev => tag
Toshi MARUYAMA
scm: mercurial: add tag test in functional test (#1981)....
r5011 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15343
assert_select 'table.entries tbody tr'
assert_select 'table.changesets tbody tr'
Toshi MARUYAMA
scm: mercurial: add tag test in functional test (#1981)....
r5011 end
end
Jean-Philippe Lang
Do not run Mercurial functional tests if the test repository is not set up....
r1006 def test_changes
Toshi MARUYAMA
Rails3: test: scm: mercurial: use "repository_path_hash" for path param...
r8816 get :changes, :id => PRJ_ID,
:path => repository_path_hash(['images', 'edit.png'])[:param]
Jean-Philippe Lang
Do not run Mercurial functional tests if the test repository is not set up....
r1006 assert_response :success
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'h2', :text => /edit.png/
Jean-Philippe Lang
Do not run Mercurial functional tests if the test repository is not set up....
r1006 end
Toshi MARUYAMA
scm: mercurial: remove trailing white-spaces and a empty line from functional test....
r5563
Jean-Philippe Lang
Do not run Mercurial functional tests if the test repository is not set up....
r1006 def test_entry_show
Toshi MARUYAMA
Rails3: test: scm: mercurial: use "repository_path_hash" for path param...
r8816 get :entry, :id => PRJ_ID,
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
Jean-Philippe Lang
Do not run Mercurial functional tests if the test repository is not set up....
r1006 assert_response :success
Toshi MARUYAMA
scm: mercurial: fix comment and change // to '' some strings of functional test....
r4511 # Line 10
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'tr#L10 td.line-code', :text => /WITHOUT ANY WARRANTY/
Jean-Philippe Lang
Do not run Mercurial functional tests if the test repository is not set up....
r1006 end
Toshi MARUYAMA
scm: mercurial: add path encoding tests in functional test (#2664, #4050)....
r4880
Toshi MARUYAMA
scm: mercurial: change Latin-1 path test methods name....
r5565 def test_entry_show_latin_1_path
Toshi MARUYAMA
scm: mercurial: add path encoding tests in functional test (#2664, #4050)....
r4880 [21, '21', 'adf805632193'].each do |r1|
Toshi MARUYAMA
scm: mercurial: change Latin-1 path test methods name....
r5565 get :entry, :id => PRJ_ID,
Toshi MARUYAMA
Rails3: test: scm: mercurial: use "repository_path_hash" for path param...
r8816 :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}-2.txt"])[:param],
:rev => r1
Toshi MARUYAMA
scm: mercurial: add path encoding tests in functional test (#2664, #4050)....
r4880 assert_response :success
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'tr#L1 td.line-code', :text => /Mercurial is a distributed version control system/
Toshi MARUYAMA
scm: mercurial: add path encoding tests in functional test (#2664, #4050)....
r4880 end
end
Toshi MARUYAMA
scm: mercurial: remove trailing white-spaces and a empty line from functional test....
r5563
Toshi MARUYAMA
scm: mercurial: add test of showing non ASCII contents in functional test....
r5570 def test_entry_show_latin_1_contents
with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
[27, '27', '7bbf4c738e71'].each do |r1|
get :entry, :id => PRJ_ID,
Toshi MARUYAMA
Rails3: test: scm: mercurial: use "repository_path_hash" for path param...
r8816 :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}.txt"])[:param],
:rev => r1
Toshi MARUYAMA
scm: mercurial: add test of showing non ASCII contents in functional test....
r5570 assert_response :success
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'tr#L1 td.line-code', :text => /test-#{@char_1}.txt/
Toshi MARUYAMA
scm: mercurial: add test of showing non ASCII contents in functional test....
r5570 end
end
end
Jean-Philippe Lang
Do not run Mercurial functional tests if the test repository is not set up....
r1006 def test_entry_download
Toshi MARUYAMA
scm: mercurial: code clean up functional test....
r5566 get :entry, :id => PRJ_ID,
Toshi MARUYAMA
Rails3: test: scm: mercurial: use "repository_path_hash" for path param...
r8816 :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param],
:format => 'raw'
Jean-Philippe Lang
Do not run Mercurial functional tests if the test repository is not set up....
r1006 assert_response :success
# File content
assert @response.body.include?('WITHOUT ANY WARRANTY')
end
Jean-Philippe Lang
Fixed: Links to repository directories don't work (#1119)....
r1350
Toshi MARUYAMA
scm: mercurial: add test of binary file should be force download in functional test (#6256)....
r5082 def test_entry_binary_force_download
Jean-Philippe Lang
Fix test failures (#22058)....
r14946 # TODO: add a binary file which is not an image to the test repo
Toshi MARUYAMA
scm: mercurial: add test of binary file should be force download in functional test (#6256)....
r5082 end
Jean-Philippe Lang
Fixed: Links to repository directories don't work (#1119)....
r1350 def test_directory_entry
Toshi MARUYAMA
Rails3: test: scm: mercurial: use "repository_path_hash" for path param...
r8816 get :entry, :id => PRJ_ID,
:path => repository_path_hash(['sources'])[:param]
Jean-Philippe Lang
Fixed: Links to repository directories don't work (#1119)....
r1350 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15343 assert_select 'h2 a', :text => 'sources'
assert_select 'table.entries tbody'
Jean-Philippe Lang
Fixed: Links to repository directories don't work (#1119)....
r1350 end
Toshi MARUYAMA
scm: mercurial: add test of binary file should be force download in functional test (#6256)....
r5082
Jean-Philippe Lang
Do not run Mercurial functional tests if the test repository is not set up....
r1006 def test_diff
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_diff at functional test...
r7091 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: change two revision diff text of mercurial (#3724)....
r4579 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_diff at functional test...
r7091 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: functional test for accept both of revision number and changeset id (#3724)....
r4544 [4, '4', 'def6d2f1254a'].each do |r1|
# Full diff of changeset 4
Toshi MARUYAMA
scm: mercurial: run both of "inline" and "side by side" diff in functional test_diff test....
r5863 ['inline', 'sbs'].each do |dt|
get :diff, :id => PRJ_ID, :rev => r1, :type => dt
assert_response :success
if @diff_c_support
# Line 22 removed
Jean-Philippe Lang
Upgrade to Rails 4.2.0 (#14534)....
r13510 assert_select 'th.line-num:contains(22) ~ td.diff_out', :text => /def remove/
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'h2', :text => /4:def6d2f1254a/
Toshi MARUYAMA
scm: mercurial: run both of "inline" and "side by side" diff in functional test_diff test....
r5863 end
Toshi MARUYAMA
scm: mercurial: change two revision diff text of mercurial (#3724)....
r4579 end
end
end
def test_diff_two_revs
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_diff_two_revs at functional test...
r7092 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: change two revision diff text of mercurial (#3724)....
r4579 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_diff_two_revs at functional test...
r7092 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: change two revision diff text of mercurial (#3724)....
r4579 [2, '400bb8672109', '400', 400].each do |r1|
[4, 'def6d2f1254a'].each do |r2|
Toshi MARUYAMA
scm: mercurial: run both of "inline" and "side by side" diff in functional test_diff_two_revs test....
r5864 ['inline', 'sbs'].each do |dt|
get :diff,
:id => PRJ_ID,
:rev => r1,
:rev_to => r2,
:type => dt
assert_response :success
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'h2', :text => /4:def6d2f1254a 2:400bb8672109/
Toshi MARUYAMA
scm: mercurial: run both of "inline" and "side by side" diff in functional test_diff_two_revs test....
r5864 end
Toshi MARUYAMA
scm: mercurial: diff '-c' option supports above Mercurial 1.2 (#3724, #7253)....
r4566 end
Toshi MARUYAMA
scm: mercurial: functional test for accept both of revision number and changeset id (#3724)....
r4544 end
Jean-Philippe Lang
Do not run Mercurial functional tests if the test repository is not set up....
r1006 end
Toshi MARUYAMA
scm: mercurial: annotate accepts both of revision number and changeset id (#3724)....
r4543
Toshi MARUYAMA
scm: mercurial: change Latin-1 path test methods name....
r5565 def test_diff_latin_1_path
Toshi MARUYAMA
scm: mercurial: add test of diff non ASCII path name in functional test....
r5569 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
[21, 'adf805632193'].each do |r1|
Toshi MARUYAMA
scm: mercurial: run both of "inline" and "side by side" diff in functional test_diff_latin_1_path test....
r5865 ['inline', 'sbs'].each do |dt|
get :diff, :id => PRJ_ID, :rev => r1, :type => dt
assert_response :success
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'table' do
assert_select 'thead th.filename', :text => /latin-1-dir\/test-#{@char_1}-2.txt/
assert_select 'tbody td.diff_in', :text => /It is written in Python/
end
Toshi MARUYAMA
scm: mercurial: run both of "inline" and "side by side" diff in functional test_diff_latin_1_path test....
r5865 end
Toshi MARUYAMA
scm: mercurial: add test of diff non ASCII path name in functional test....
r5569 end
Toshi MARUYAMA
scm: mercurial: add path encoding tests in functional test (#2664, #4050)....
r4880 end
end
Toshi MARUYAMA
use git diff format for all diff (#11868)...
r10245 def test_diff_should_show_modified_filenames
get :diff, :id => PRJ_ID, :rev => '400bb8672109', :type => 'inline'
assert_response :success
assert_select 'th.filename', :text => 'sources/watchers_controller.rb'
end
def test_diff_should_show_deleted_filenames
get :diff, :id => PRJ_ID, :rev => 'b3a615152df8', :type => 'inline'
assert_response :success
assert_select 'th.filename', :text => 'sources/welcome_controller.rb'
end
Jean-Philippe Lang
Do not run Mercurial functional tests if the test repository is not set up....
r1006 def test_annotate
Toshi MARUYAMA
Rails3: test: scm: mercurial: use "repository_path_hash" for path param...
r8816 get :annotate, :id => PRJ_ID,
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
Jean-Philippe Lang
Do not run Mercurial functional tests if the test repository is not set up....
r1006 assert_response :success
Jean-Philippe Lang
Use assert_select instead of assert_tag....
r9923
Jean-Philippe Lang
Don't repeat revision on annotate view....
r9922 # Line 22, revision 4:def6d2f1254a
Jean-Philippe Lang
Use assert_select instead of assert_tag....
r9923 assert_select 'tr' do
assert_select 'th.line-num', :text => '22'
assert_select 'td.revision', :text => '4:def6d2f1254a'
assert_select 'td.author', :text => 'jsmith'
assert_select 'td', :text => /remove_watcher/
end
Jean-Philippe Lang
Do not run Mercurial functional tests if the test repository is not set up....
r1006 end
Toshi MARUYAMA
scm: mercurial: fix error on revision page for empty revision (#7307)....
r4584
Toshi MARUYAMA
scm: mercurial: add functional test of annotate file which does not exist in *tip* is not found....
r5921 def test_annotate_not_in_tip
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_annotate_not_in_tip at functional test...
r7093 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: add functional test of annotate file which does not exist in *tip* is not found....
r5921 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_annotate_not_in_tip at functional test...
r7093 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: add functional test of annotate file which does not exist in *tip* is not found....
r5921 get :annotate, :id => PRJ_ID,
Toshi MARUYAMA
Rails3: test: scm: mercurial: use "repository_path_hash" for path param...
r8816 :path => repository_path_hash(['sources', 'welcome_controller.rb'])[:param]
Toshi MARUYAMA
scm: mercurial: add functional test of annotate file which does not exist in *tip* is not found....
r5921 assert_response 404
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select_error /was not found/
Toshi MARUYAMA
scm: mercurial: add functional test of annotate file which does not exist in *tip* is not found....
r5921 end
Toshi MARUYAMA
scm: functional test of using format_revision() for annotate (#3724)....
r4614 def test_annotate_at_given_revision
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_annotate_at_given_revision at functional test...
r7094 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: functional test of using format_revision() for annotate (#3724)....
r4614 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_annotate_at_given_revision at functional test...
r7094 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: functional test of using format_revision() for annotate (#3724)....
r4614 [2, '400bb8672109', '400', 400].each do |r1|
Toshi MARUYAMA
scm: mercurial: code clean up functional test....
r5566 get :annotate, :id => PRJ_ID, :rev => r1,
Toshi MARUYAMA
Rails3: test: scm: mercurial: use "repository_path_hash" for path param...
r8816 :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
Toshi MARUYAMA
scm: functional test of using format_revision() for annotate (#3724)....
r4614 assert_response :success
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'h2', :text => /@ 2:400bb8672109/
Toshi MARUYAMA
scm: functional test of using format_revision() for annotate (#3724)....
r4614 end
end
Toshi MARUYAMA
scm: mercurial: change Latin-1 path test methods name....
r5565 def test_annotate_latin_1_path
Toshi MARUYAMA
scm: mercurial: add path encoding tests in functional test (#2664, #4050)....
r4880 [21, '21', 'adf805632193'].each do |r1|
Toshi MARUYAMA
scm: mercurial: fix indent test_annotate_latin_1_path() in functional test....
r5571 get :annotate, :id => PRJ_ID,
Toshi MARUYAMA
Rails3: test: scm: mercurial: use "repository_path_hash" for path param...
r8816 :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}-2.txt"])[:param],
:rev => r1
Toshi MARUYAMA
scm: mercurial: add path encoding tests in functional test (#2664, #4050)....
r4880 assert_response :success
Toshi MARUYAMA
use assert_select instead of assert_tag in Mercurial annotate test (#14931)...
r11910 assert_select "th.line-num", :text => '1' do
assert_select "+ td.revision" do
assert_select "a", :text => '20:709858aafd1b'
assert_select "+ td.author", :text => "jsmith" do
assert_select "+ td",
:text => "Mercurial is a distributed version control system."
end
end
end
Toshi MARUYAMA
scm: mercurial: add path encoding tests in functional test (#2664, #4050)....
r4880 end
end
Toshi MARUYAMA
scm: mercurial: add test of annotate non ASCII contents in functional test....
r5572 def test_annotate_latin_1_contents
with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
[27, '7bbf4c738e71'].each do |r1|
get :annotate, :id => PRJ_ID,
Toshi MARUYAMA
Rails3: test: scm: mercurial: use "repository_path_hash" for path param...
r8816 :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}.txt"])[:param],
:rev => r1
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'tr#L1 td.line-code', :text => /test-#{@char_1}.txt/
Toshi MARUYAMA
scm: mercurial: add test of annotate non ASCII contents in functional test....
r5572 end
end
end
Toshi MARUYAMA
add test of revision page title (#14138)...
r11678 def test_revision
assert_equal 0, @repository.changesets.count
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
['1', '9d5b5b', '9d5b5b004199'].each do |r|
with_settings :default_language => "en" do
get :revision, :id => PRJ_ID, :rev => r
assert_response :success
assert_select 'title',
Toshi MARUYAMA
add changeset comment in revision page title (#14138)...
r11679 :text => 'Revision 1:9d5b5b004199 - Added 2 files and modified one. - eCookbook Subproject 1 - Redmine'
Toshi MARUYAMA
add test of revision page title (#14138)...
r11678 end
end
end
Toshi MARUYAMA
scm: mercurial: fix error on revision page for empty revision (#7307)....
r4584 def test_empty_revision
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_empty_revision at functional test...
r7095 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: fix error on revision page for empty revision (#7307)....
r4584 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_empty_revision at functional test...
r7095 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: fix error on revision page for empty revision (#7307)....
r4584 ['', ' ', nil].each do |r|
Toshi MARUYAMA
scm: mercurial: use constant for project id in functional test....
r5081 get :revision, :id => PRJ_ID, :rev => r
Jean-Philippe Lang
Respond with 404 instead of 500 when revision/entry is not found in the repository (#7307)....
r4590 assert_response 404
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select_error /was not found/
Toshi MARUYAMA
scm: mercurial: fix error on revision page for empty revision (#7307)....
r4584 end
end
Toshi MARUYAMA
scm: mercurial: add functional test of destroying valid repository (#8777, #6713, #4725)....
r6123
def test_destroy_valid_repository
@request.session[:user_id] = 1 # admin
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_destroy_valid_repository at functional test...
r7085 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: add functional test of destroying valid repository (#8777, #6713, #4725)....
r6123 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: mercurial: fix error of test_destroy_valid_repository at functional test...
r7085 assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: mercurial: add functional test of destroying valid repository (#8777, #6713, #4725)....
r6123
Jean-Philippe Lang
Resourcified repositories for CRUD operations to prepare for multiple SCM per project (#779)....
r8528 assert_difference 'Repository.count', -1 do
delete :destroy, :id => @repository.id
end
Toshi MARUYAMA
scm: mercurial: add functional test of destroying valid repository (#8777, #6713, #4725)....
r6123 assert_response 302
@project.reload
assert_nil @project.repository
end
Toshi MARUYAMA
scm: mercurial: add functional test of destroying invalid repository (#8777, #6713, #4725)....
r6127
def test_destroy_invalid_repository
@request.session[:user_id] = 1 # admin
Jean-Philippe Lang
Resourcified repositories for CRUD operations to prepare for multiple SCM per project (#779)....
r8528 @project.repository.destroy
@repository = Repository::Mercurial.create!(
Toshi MARUYAMA
scm: mercurial: add functional test of destroying invalid repository (#8777, #6713, #4725)....
r6127 :project => Project.find(PRJ_ID),
:url => "/invalid",
:path_encoding => 'ISO-8859-1'
)
@repository.fetch_changesets
assert_equal 0, @repository.changesets.count
Jean-Philippe Lang
Resourcified repositories for CRUD operations to prepare for multiple SCM per project (#779)....
r8528 assert_difference 'Repository.count', -1 do
delete :destroy, :id => @repository.id
end
Toshi MARUYAMA
scm: mercurial: add functional test of destroying invalid repository (#8777, #6713, #4725)....
r6127 assert_response 302
@project.reload
assert_nil @project.repository
end
Jean-Philippe Lang
Do not run Mercurial functional tests if the test repository is not set up....
r1006 else
puts "Mercurial test repository NOT FOUND. Skipping functional tests !!!"
def test_fake; assert true end
Jean-Philippe Lang
Added a Mercurial test repository with unit and functional tests....
r978 end
end