kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.2 KiB
101 lines
3.2 KiB
13 years ago
|
#-- encoding: UTF-8
|
||
14 years ago
|
#-- copyright
|
||
12 years ago
|
# OpenProject is a project management system.
|
||
10 years ago
|
# Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
|
||
14 years ago
|
#
|
||
16 years ago
|
# This program is free software; you can redistribute it and/or
|
||
12 years ago
|
# modify it under the terms of the GNU General Public License version 3.
|
||
14 years ago
|
#
|
||
11 years ago
|
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
||
|
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||
|
# Copyright (C) 2010-2013 the ChiliProject Team
|
||
|
#
|
||
|
# 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.
|
||
|
#
|
||
14 years ago
|
# See doc/COPYRIGHT.rdoc for more details.
|
||
|
#++
|
||
16 years ago
|
|
||
10 years ago
|
require 'legacy_spec_helper'
|
||
16 years ago
|
require 'sys_controller'
|
||
|
|
||
11 years ago
|
describe SysController, type: :controller do
|
||
12 years ago
|
fixtures :all
|
||
14 years ago
|
|
||
11 years ago
|
before do
|
||
16 years ago
|
Setting.sys_api_enabled = '1'
|
||
16 years ago
|
Setting.enabled_scm = %w(Subversion Git)
|
||
16 years ago
|
end
|
||
14 years ago
|
|
||
11 years ago
|
it 'should projects with repository enabled' do
|
||
16 years ago
|
get :projects
|
||
|
assert_response :success
|
||
10 years ago
|
assert_equal 'application/xml', response.content_type
|
||
10 years ago
|
with_options tag: 'projects' do |test|
|
||
|
test.assert_tag children: { count: Project.active.has_module(:repository).count }
|
||
16 years ago
|
end
|
||
|
end
|
||
|
|
||
11 years ago
|
it 'should create project repository' do
|
||
16 years ago
|
assert_nil Project.find(4).repository
|
||
14 years ago
|
|
||
10 years ago
|
post :create_project_repository, id: 4,
|
||
|
vendor: 'Subversion',
|
||
10 years ago
|
repository: { url: 'file:///create/project/repository/subproject2' }
|
||
16 years ago
|
assert_response :created
|
||
14 years ago
|
|
||
16 years ago
|
r = Project.find(4).repository
|
||
|
assert r.is_a?(Repository::Subversion)
|
||
|
assert_equal 'file:///create/project/repository/subproject2', r.url
|
||
|
end
|
||
14 years ago
|
|
||
11 years ago
|
it 'should fetch changesets' do
|
||
10 years ago
|
expect_any_instance_of(Repository::Subversion).to receive(:fetch_changesets).and_return(true)
|
||
15 years ago
|
get :fetch_changesets
|
||
|
assert_response :success
|
||
|
end
|
||
14 years ago
|
|
||
11 years ago
|
it 'should fetch changesets one project' do
|
||
10 years ago
|
expect_any_instance_of(Repository::Subversion).to receive(:fetch_changesets).and_return(true)
|
||
10 years ago
|
get :fetch_changesets, id: 'ecookbook'
|
||
15 years ago
|
assert_response :success
|
||
|
end
|
||
14 years ago
|
|
||
11 years ago
|
it 'should fetch changesets unknown project' do
|
||
10 years ago
|
get :fetch_changesets, id: 'unknown'
|
||
15 years ago
|
assert_response 404
|
||
|
end
|
||
14 years ago
|
|
||
11 years ago
|
it 'should disabled ws should respond with 403 error' do
|
||
10 years ago
|
with_settings sys_api_enabled: '0' do
|
||
15 years ago
|
get :projects
|
||
|
assert_response 403
|
||
|
end
|
||
|
end
|
||
14 years ago
|
|
||
11 years ago
|
it 'should api key' do
|
||
10 years ago
|
with_settings sys_api_key: 'my_secret_key' do
|
||
|
get :projects, key: 'my_secret_key'
|
||
15 years ago
|
assert_response :success
|
||
|
end
|
||
|
end
|
||
14 years ago
|
|
||
11 years ago
|
it 'should wrong key should respond with 403 error' do
|
||
10 years ago
|
with_settings sys_api_enabled: 'my_secret_key' do
|
||
|
get :projects, key: 'wrong_key'
|
||
15 years ago
|
assert_response 403
|
||
|
end
|
||
|
end
|
||
16 years ago
|
end
|