summaryrefslogtreecommitdiffstats
path: root/test/integration
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-07-23 11:26:04 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-07-23 11:26:04 +0000
commitd74f0bfd5c53962e332c2dd4d30dafaa1105b92b (patch)
treef3eaf66d67c3a87fb34340561bf188d364de623c /test/integration
parent41bb302594b48152b87c92f196c915f499093bbf (diff)
downloadredmine-d74f0bfd5c53962e332c2dd4d30dafaa1105b92b.tar.gz
redmine-d74f0bfd5c53962e332c2dd4d30dafaa1105b92b.zip
Merged rails-5.1 branch (#23630).
git-svn-id: http://svn.redmine.org/redmine/trunk@16859 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/api_test/attachments_test.rb2
-rw-r--r--test/integration/application_test.rb4
-rw-r--r--test/integration/lib/redmine/field_format/attachment_format_test.rb2
-rw-r--r--test/integration/routing/attachments_test.rb3
-rw-r--r--test/integration/routing/repositories_test.rb94
-rw-r--r--test/integration/routing/welcome_test.rb2
-rw-r--r--test/integration/welcome_test.rb28
7 files changed, 72 insertions, 63 deletions
diff --git a/test/integration/api_test/attachments_test.rb b/test/integration/api_test/attachments_test.rb
index 0eda0b073..4983a3d64 100644
--- a/test/integration/api_test/attachments_test.rb
+++ b/test/integration/api_test/attachments_test.rb
@@ -71,7 +71,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
test "GET /attachments/download/:id/:filename should deny access without credentials" do
get '/attachments/download/7/archive.zip'
- assert_response 302
+ assert_response 401
set_tmp_attachments_directory
end
diff --git a/test/integration/application_test.rb b/test/integration/application_test.rb
index 2b572a238..7990b4265 100644
--- a/test/integration/application_test.rb
+++ b/test/integration/application_test.rb
@@ -63,9 +63,9 @@ class ApplicationTest < Redmine::IntegrationTest
assert_nil session[:user_id]
end
- def test_missing_template_should_respond_with_404
+ def test_missing_template_should_respond_with_4xx
get '/login.png'
- assert_response 404
+ assert_response 406
end
def test_invalid_token_should_call_custom_handler
diff --git a/test/integration/lib/redmine/field_format/attachment_format_test.rb b/test/integration/lib/redmine/field_format/attachment_format_test.rb
index 2510b7c64..759a73b17 100644
--- a/test/integration/lib/redmine/field_format/attachment_format_test.rb
+++ b/test/integration/lib/redmine/field_format/attachment_format_test.rb
@@ -85,7 +85,7 @@ class AttachmentFieldFormatTest < Redmine::IntegrationTest
# preview the attachment
get link.attr('href')
assert_response :success
- assert_template :file
+ assert_select 'h2', :text => 'testfile.txt'
end
def test_create_without_attachment
diff --git a/test/integration/routing/attachments_test.rb b/test/integration/routing/attachments_test.rb
index cf417cee5..096591f2d 100644
--- a/test/integration/routing/attachments_test.rb
+++ b/test/integration/routing/attachments_test.rb
@@ -20,7 +20,8 @@ require File.expand_path('../../../test_helper', __FILE__)
class RoutingAttachmentsTest < Redmine::RoutingTest
def test_attachments
should_route 'GET /attachments/1' => 'attachments#show', :id => '1'
- should_route 'GET /attachments/1/filename.ext' => 'attachments#show', :id => '1', :filename => 'filename.ext'
+ should_route 'GET /attachments/1/filename.ext' => 'attachments#show', :id => '1', :filename => 'filename.ext', :format => 'html'
+ should_route 'GET /attachments/1/filename.txt' => 'attachments#show', :id => '1', :filename => 'filename.txt', :format => 'html'
should_route 'GET /attachments/download/1' => 'attachments#download', :id => '1'
should_route 'GET /attachments/download/1/filename.ext' => 'attachments#download', :id => '1', :filename => 'filename.ext'
diff --git a/test/integration/routing/repositories_test.rb b/test/integration/routing/repositories_test.rb
index e0b9d9e6a..337686169 100644
--- a/test/integration/routing/repositories_test.rb
+++ b/test/integration/routing/repositories_test.rb
@@ -18,15 +18,15 @@
require File.expand_path('../../../test_helper', __FILE__)
class RoutingRepositoriesTest < Redmine::RoutingTest
+
def setup
- @path_hash = repository_path_hash(%w[path to file.c])
- assert_equal "path/to/file.c", @path_hash[:path]
- assert_equal "path/to/file.c", @path_hash[:param]
+ @paths = ['path/to/file.c', 'path/to/index.html']
end
def test_repositories_resources
should_route 'GET /projects/foo/repositories/new' => 'repositories#new', :project_id => 'foo'
should_route 'POST /projects/foo/repositories' => 'repositories#create', :project_id => 'foo'
+
should_route 'GET /repositories/1/edit' => 'repositories#edit', :id => '1'
should_route 'PUT /repositories/1' => 'repositories#update', :id => '1'
should_route 'DELETE /repositories/1' => 'repositories#destroy', :id => '1'
@@ -53,19 +53,15 @@ class RoutingRepositoriesTest < Redmine::RoutingTest
should_route 'GET /projects/foo/repository/revisions.atom' => 'repositories#revisions', :id => 'foo', :format => 'atom'
should_route 'GET /projects/foo/repository/revisions/2457' => 'repositories#revision', :id => 'foo', :rev => '2457'
- should_route 'GET /projects/foo/repository/revisions/2457/show' => 'repositories#show', :id => 'foo', :rev => '2457'
- should_route 'GET /projects/foo/repository/revisions/2457/diff' => 'repositories#diff', :id => 'foo', :rev => '2457'
-
- should_route "GET /projects/foo/repository/revisions/2457/show/#{@path_hash[:path]}" => 'repositories#show',
- :id => 'foo', :rev => '2457', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/revisions/2457/diff/#{@path_hash[:path]}" => 'repositories#diff',
- :id => 'foo', :rev => '2457', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/revisions/2457/entry/#{@path_hash[:path]}" => 'repositories#entry',
- :id => 'foo', :rev => '2457', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/revisions/2457/raw/#{@path_hash[:path]}" => 'repositories#raw',
- :id => 'foo', :rev => '2457', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/revisions/2457/annotate/#{@path_hash[:path]}" => 'repositories#annotate',
- :id => 'foo', :rev => '2457', :path => @path_hash[:param]
+ should_route 'GET /projects/foo/repository/revisions/2457/show' => 'repositories#show', :id => 'foo', :rev => '2457', :format => 'html'
+ should_route 'GET /projects/foo/repository/revisions/2457/diff' => 'repositories#diff', :id => 'foo', :rev => '2457', :format => 'html'
+
+ %w(show diff entry raw annotate).each do |action|
+ @paths.each do |path|
+ should_route "GET /projects/foo/repository/revisions/2457/#{action}/#{path}" => "repositories##{action}",
+ :id => 'foo', :rev => '2457', :path => path, :format => 'html'
+ end
+ end
end
def test_repositories_revisions_with_repository_id
@@ -74,53 +70,37 @@ class RoutingRepositoriesTest < Redmine::RoutingTest
should_route 'GET /projects/foo/repository/foo/revisions.atom' => 'repositories#revisions', :id => 'foo', :repository_id => 'foo', :format => 'atom'
should_route 'GET /projects/foo/repository/foo/revisions/2457' => 'repositories#revision', :id => 'foo', :repository_id => 'foo', :rev => '2457'
- should_route 'GET /projects/foo/repository/foo/revisions/2457/show' => 'repositories#show', :id => 'foo', :repository_id => 'foo', :rev => '2457'
- should_route 'GET /projects/foo/repository/foo/revisions/2457/diff' => 'repositories#diff', :id => 'foo', :repository_id => 'foo', :rev => '2457'
-
- should_route "GET /projects/foo/repository/foo/revisions/2457/show/#{@path_hash[:path]}" => 'repositories#show',
- :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/foo/revisions/2457/diff/#{@path_hash[:path]}" => 'repositories#diff',
- :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/foo/revisions/2457/entry/#{@path_hash[:path]}" => 'repositories#entry',
- :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/foo/revisions/2457/raw/#{@path_hash[:path]}" => 'repositories#raw',
- :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/foo/revisions/2457/annotate/#{@path_hash[:path]}" => 'repositories#annotate',
- :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => @path_hash[:param]
+ should_route 'GET /projects/foo/repository/foo/revisions/2457/show' => 'repositories#show', :id => 'foo', :repository_id => 'foo', :rev => '2457', :format => 'html'
+ should_route 'GET /projects/foo/repository/foo/revisions/2457/diff' => 'repositories#diff', :id => 'foo', :repository_id => 'foo', :rev => '2457', :format => 'html'
+
+ %w(show diff entry raw annotate).each do |action|
+ @paths.each do |path|
+ should_route "GET /projects/foo/repository/foo/revisions/2457/#{action}/#{path}" => "repositories##{action}",
+ :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => path, :format => 'html'
+ end
+ end
end
def test_repositories_non_revisions_path
- should_route 'GET /projects/foo/repository/changes' => 'repositories#changes', :id => 'foo'
-
- should_route "GET /projects/foo/repository/changes/#{@path_hash[:path]}" => 'repositories#changes',
- :id => 'foo', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/diff/#{@path_hash[:path]}" => 'repositories#diff',
- :id => 'foo', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/browse/#{@path_hash[:path]}" => 'repositories#browse',
- :id => 'foo', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/entry/#{@path_hash[:path]}" => 'repositories#entry',
- :id => 'foo', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/raw/#{@path_hash[:path]}" => 'repositories#raw',
- :id => 'foo', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/annotate/#{@path_hash[:path]}" => 'repositories#annotate',
- :id => 'foo', :path => @path_hash[:param]
+ should_route 'GET /projects/foo/repository/changes' => 'repositories#changes', :id => 'foo', :format => 'html'
+
+ %w(changes diff browse entry raw annotate).each do |action|
+ @paths.each do |path|
+ should_route "GET /projects/foo/repository/#{action}/#{path}" => "repositories##{action}",
+ :id => 'foo', :path => path, :format => 'html'
+ end
+ end
end
def test_repositories_non_revisions_path_with_repository_id
- should_route 'GET /projects/foo/repository/svn/changes' => 'repositories#changes', :id => 'foo', :repository_id => 'svn'
-
- should_route "GET /projects/foo/repository/svn/changes/#{@path_hash[:path]}" => 'repositories#changes',
- :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/svn/diff/#{@path_hash[:path]}" => 'repositories#diff',
- :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/svn/browse/#{@path_hash[:path]}" => 'repositories#browse',
- :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/svn/entry/#{@path_hash[:path]}" => 'repositories#entry',
- :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/svn/raw/#{@path_hash[:path]}" => 'repositories#raw',
- :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/svn/annotate/#{@path_hash[:path]}" => 'repositories#annotate',
- :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
+ should_route 'GET /projects/foo/repository/svn/changes' => 'repositories#changes', :id => 'foo', :repository_id => 'svn', :format => 'html'
+
+ %w(changes diff browse entry raw annotate).each do |action|
+ @paths.each do |path|
+ should_route "GET /projects/foo/repository/svn/#{action}/#{path}" => "repositories##{action}",
+ :id => 'foo', :repository_id => 'svn', :path => path, :format => 'html'
+ end
+ end
end
def test_repositories_related_issues
diff --git a/test/integration/routing/welcome_test.rb b/test/integration/routing/welcome_test.rb
index 68aaf5a13..ad064f35d 100644
--- a/test/integration/routing/welcome_test.rb
+++ b/test/integration/routing/welcome_test.rb
@@ -20,6 +20,6 @@ require File.expand_path('../../../test_helper', __FILE__)
class RoutingWelcomeTest < Redmine::RoutingTest
def test_welcome
should_route 'GET /' => 'welcome#index'
- should_route 'GET /robots.txt' => 'welcome#robots'
+ should_route 'GET /robots.txt' => 'welcome#robots', :format => 'txt'
end
end
diff --git a/test/integration/welcome_test.rb b/test/integration/welcome_test.rb
new file mode 100644
index 000000000..3577fe059
--- /dev/null
+++ b/test/integration/welcome_test.rb
@@ -0,0 +1,28 @@
+# Redmine - project management software
+# Copyright (C) 2006-2017 Jean-Philippe Lang
+#
+# 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.
+#
+# 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.
+#
+# 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.
+
+require File.expand_path('../../test_helper', __FILE__)
+
+class WelcomeTest < Redmine::IntegrationTest
+
+ def test_robots
+ get '/robots.txt'
+ assert_response :success
+ assert_equal 'text/plain', @response.content_type
+ assert @response.body.match(%r{^Disallow: /projects/ecookbook/issues\r?$})
+ end
+end