Elimina el plugin Redmine Git Hosting
Finalmente se descarta por los problemas de configuración y potencial brecha de seguridad al requerir acceso global al puerto ssh.
This commit is contained in:
parent
bdd66d941f
commit
0edadcfed8
494 changed files with 0 additions and 36768 deletions
|
@ -1,82 +0,0 @@
|
|||
require File.expand_path('../spec_helper', __dir__)
|
||||
|
||||
describe GoRedirectorController do
|
||||
def check_response_with_smart_http(repository, opts = {})
|
||||
enable_go_url(repository)
|
||||
yield
|
||||
call_page(repository, opts[:status])
|
||||
end
|
||||
|
||||
def check_response_without_smart_http(repository, opts = {})
|
||||
disable_go_url(repository)
|
||||
yield
|
||||
call_page(repository, opts[:status])
|
||||
end
|
||||
|
||||
def call_page(repository, status)
|
||||
get :index, params: { repo_path: repository.redmine_repository_path }
|
||||
expect(response.status).to eq status
|
||||
end
|
||||
|
||||
def enable_go_url(repository)
|
||||
repository.extra[:git_http] = true
|
||||
repository.extra[:git_go] = true
|
||||
repository.extra.save!
|
||||
end
|
||||
|
||||
def disable_go_url(repository)
|
||||
repository.extra[:git_http] = false
|
||||
repository.extra[:git_go] = false
|
||||
repository.extra.save!
|
||||
end
|
||||
|
||||
def enable_public_repo(repository)
|
||||
repository.extra[:public_repo] = true
|
||||
repository.extra.save!
|
||||
end
|
||||
|
||||
describe 'GET #index' do
|
||||
context 'when project is public' do
|
||||
let(:project) { FactoryBot.create(:project, is_public: true) }
|
||||
let(:repository) { create_git_repository(project: project) }
|
||||
let(:anonymous_user) { create_anonymous_user }
|
||||
|
||||
context 'and SmartHTTP is enabled' do
|
||||
it 'renders 200' do
|
||||
check_response_with_smart_http(repository, status: 200) { set_session_user(anonymous_user) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'and SmartHTTP is disabled' do
|
||||
it 'renders 403' do
|
||||
check_response_without_smart_http(repository, status: 403) { set_session_user(anonymous_user) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when project is private' do
|
||||
let(:project) { FactoryBot.create(:project, is_public: false) }
|
||||
let(:repository) { create_git_repository(project: project) }
|
||||
let(:anonymous_user) { create_anonymous_user }
|
||||
|
||||
context 'and SmartHTTP is enabled' do
|
||||
it 'renders 403' do
|
||||
check_response_with_smart_http(repository, status: 403) { set_session_user(anonymous_user) }
|
||||
end
|
||||
|
||||
context 'when repository is public' do
|
||||
it 'renders 200' do
|
||||
enable_public_repo(repository)
|
||||
check_response_with_smart_http(repository, status: 200) { set_session_user(anonymous_user) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'and SmartHTTP is disabled' do
|
||||
it 'renders 403' do
|
||||
check_response_without_smart_http(repository, status: 403) { set_session_user(anonymous_user) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,70 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
require 'sshkey'
|
||||
|
||||
describe RepositoryDeploymentCredentialsController do
|
||||
def self.skip_actions
|
||||
['show']
|
||||
end
|
||||
|
||||
include CrudControllerSpec::Base
|
||||
|
||||
def permissions
|
||||
%i[manage_repository create_repository_deployment_credentials view_repository_deployment_credentials
|
||||
edit_repository_deployment_credentials]
|
||||
end
|
||||
|
||||
def create_object
|
||||
FactoryBot.create(:repository_deployment_credential,
|
||||
repository_id: @repository.id,
|
||||
user_id: @member_user.id,
|
||||
gitolite_public_key_id: FactoryBot.create(:gitolite_public_key,
|
||||
user_id: @member_user.id,
|
||||
key_type: 1,
|
||||
key: SSHKey.generate.ssh_public_key).id)
|
||||
end
|
||||
|
||||
def success_url
|
||||
"/repositories/#{@repository.id}/edit?tab=repository_deployment_credentials"
|
||||
end
|
||||
|
||||
def variable_for_index
|
||||
:repository_deployment_credentials
|
||||
end
|
||||
|
||||
def main_variable
|
||||
:credential
|
||||
end
|
||||
|
||||
def tested_klass
|
||||
RepositoryDeploymentCredential
|
||||
end
|
||||
|
||||
def valid_params_for_create
|
||||
public_key = FactoryBot.create(:gitolite_public_key,
|
||||
user_id: @member_user.id,
|
||||
key_type: 1,
|
||||
key: SSHKey.generate.ssh_public_key)
|
||||
{ repository_deployment_credential: { gitolite_public_key_id: public_key.id, perm: 'RW+' } }
|
||||
end
|
||||
|
||||
def invalid_params_for_create
|
||||
{ repository_deployment_credential: { url: 'git@example.com:john_doe3/john_doe3/john_doe3.git', push_mode: 0 } }
|
||||
end
|
||||
|
||||
def valid_params_for_update
|
||||
{ id: @object.id, repository_deployment_credential: { perm: 'R' } }
|
||||
end
|
||||
|
||||
def updated_attribute
|
||||
:perm
|
||||
end
|
||||
|
||||
def updated_attribute_value
|
||||
'R'
|
||||
end
|
||||
|
||||
def invalid_params_for_update
|
||||
{ id: @object.id, repository_deployment_credential: { perm: '' } }
|
||||
end
|
||||
end
|
|
@ -1,59 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
describe RepositoryGitConfigKeysController do
|
||||
include CrudControllerSpec::Base
|
||||
|
||||
def permissions
|
||||
[:manage_repository, :create_repository_git_config_keys, :view_repository_git_config_keys, :edit_repository_git_config_keys]
|
||||
end
|
||||
|
||||
def create_object
|
||||
FactoryBot.create(:repository_git_config_key, repository_id: @repository.id)
|
||||
end
|
||||
|
||||
def success_url
|
||||
"/repositories/#{@repository.id}/edit?tab=repository_git_config_keys"
|
||||
end
|
||||
|
||||
def variable_for_index
|
||||
:repository_git_config_keys
|
||||
end
|
||||
|
||||
def main_variable
|
||||
:git_config_key
|
||||
end
|
||||
|
||||
def tested_klass
|
||||
RepositoryGitConfigKey
|
||||
end
|
||||
|
||||
def valid_params_for_create
|
||||
{ repository_git_config_key: { key: 'foo.bar1', value: 0, type: 'RepositoryGitConfigKey::GitConfig' } }
|
||||
end
|
||||
|
||||
def invalid_params_for_create
|
||||
{ repository_git_config_key: { key: '', value: 0 } }
|
||||
end
|
||||
|
||||
def valid_params_for_update
|
||||
{ id: @object.id, repository_git_config_key: { key: 'foo.bar1', value: 1 } }
|
||||
end
|
||||
|
||||
def updated_attribute
|
||||
:value
|
||||
end
|
||||
|
||||
def updated_attribute_value
|
||||
'1'
|
||||
end
|
||||
|
||||
def invalid_params_for_update
|
||||
{ id: @object.id, repository_git_config_key: { key: 'foo', value: 1 } }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def base_options
|
||||
{ repository_id: @repository.id, type: 'git_keys' }.clone
|
||||
end
|
||||
end
|
|
@ -1,72 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
describe RepositoryMirrorsController do
|
||||
include CrudControllerSpec::Base
|
||||
|
||||
def permissions
|
||||
%i[manage_repository create_repository_mirrors view_repository_mirrors edit_repository_mirrors push_repository_mirrors]
|
||||
end
|
||||
|
||||
def create_object
|
||||
FactoryBot.create(:repository_mirror, repository_id: @repository.id)
|
||||
end
|
||||
|
||||
def success_url
|
||||
"/repositories/#{@repository.id}/edit?tab=repository_mirrors"
|
||||
end
|
||||
|
||||
def variable_for_index
|
||||
:repository_mirrors
|
||||
end
|
||||
|
||||
def main_variable
|
||||
:mirror
|
||||
end
|
||||
|
||||
def tested_klass
|
||||
RepositoryMirror
|
||||
end
|
||||
|
||||
def valid_params_for_create
|
||||
{ repository_mirror: { url: 'ssh://git@example.com:22/john_doe2/john_doe2/john_doe2.git', push_mode: 0 } }
|
||||
end
|
||||
|
||||
def invalid_params_for_create
|
||||
{ repository_mirror: { url: 'git@example.com:john_doe3/john_doe3/john_doe3.git', push_mode: 0 } }
|
||||
end
|
||||
|
||||
def valid_params_for_update
|
||||
{ id: @object.id, repository_mirror: { url: 'ssh://git@redmine.example.org/project1/project2/project3/project14.git' } }
|
||||
end
|
||||
|
||||
def updated_attribute
|
||||
:url
|
||||
end
|
||||
|
||||
def updated_attribute_value
|
||||
'ssh://git@redmine.example.org/project1/project2/project3/project14.git'
|
||||
end
|
||||
|
||||
def invalid_params_for_update
|
||||
{ id: @object.id, repository_mirror: { url: 'git@example.com:john_doe3/john_doe3/john_doe3.git' } }
|
||||
end
|
||||
|
||||
describe 'GET #push' do
|
||||
context 'with sufficient permissions' do
|
||||
it 'renders the :push view' do
|
||||
set_session_user(@member_user)
|
||||
get :push,
|
||||
params: { repository_id: @repository.id, id: @object.id }
|
||||
end
|
||||
end
|
||||
|
||||
context 'with unsufficient permissions' do
|
||||
it 'renders 403' do
|
||||
set_session_user(@anonymous_user)
|
||||
get :push,
|
||||
params: { repository_id: @repository.id, id: @object.id }
|
||||
check_status(403)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,53 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
describe RepositoryPostReceiveUrlsController do
|
||||
include CrudControllerSpec::Base
|
||||
|
||||
def permissions
|
||||
%i[manage_repository create_repository_post_receive_urls view_repository_post_receive_urls edit_repository_post_receive_urls]
|
||||
end
|
||||
|
||||
def create_object
|
||||
FactoryBot.create(:repository_post_receive_url, repository_id: @repository.id)
|
||||
end
|
||||
|
||||
def success_url
|
||||
"/repositories/#{@repository.id}/edit?tab=repository_post_receive_urls"
|
||||
end
|
||||
|
||||
def variable_for_index
|
||||
:repository_post_receive_urls
|
||||
end
|
||||
|
||||
def main_variable
|
||||
:post_receive_url
|
||||
end
|
||||
|
||||
def tested_klass
|
||||
RepositoryPostReceiveUrl
|
||||
end
|
||||
|
||||
def valid_params_for_create
|
||||
{ repository_post_receive_url: { url: 'http://example.com', mode: :github } }
|
||||
end
|
||||
|
||||
def invalid_params_for_create
|
||||
{ repository_post_receive_url: { url: 'example.com', push_mode: 0 } }
|
||||
end
|
||||
|
||||
def valid_params_for_update
|
||||
{ id: @object.id, repository_post_receive_url: { url: 'http://example.com/toto.php' } }
|
||||
end
|
||||
|
||||
def updated_attribute
|
||||
:url
|
||||
end
|
||||
|
||||
def updated_attribute_value
|
||||
'http://example.com/toto.php'
|
||||
end
|
||||
|
||||
def invalid_params_for_update
|
||||
{ id: @object.id, repository_post_receive_url: { url: 'example.com' } }
|
||||
end
|
||||
end
|
|
@ -1,37 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
require 'sshkey'
|
||||
|
||||
describe UsersController do
|
||||
describe 'GET #edit' do
|
||||
context 'with git hosting patch' do
|
||||
let(:user) { create_admin_user }
|
||||
let(:user_key) do
|
||||
create_ssh_key(user_id: user.id,
|
||||
title: 'user_key',
|
||||
key: SSHKey.generate(comment: 'faker_user_key@john_doe').ssh_public_key,
|
||||
key_type: 0)
|
||||
end
|
||||
let(:deploy_key) do
|
||||
create_ssh_key(user_id: user.id,
|
||||
title: 'deploy_key',
|
||||
key: SSHKey.generate(comment: 'faker_deploy_key@john_doe').ssh_public_key,
|
||||
key_type: 1)
|
||||
end
|
||||
|
||||
it 'populates an array of gitolite_user_keys' do
|
||||
set_session_user(user)
|
||||
get :edit,
|
||||
params: { id: user.id }
|
||||
expect(assigns(:gitolite_user_keys)).to eq [user_key]
|
||||
end
|
||||
|
||||
# it 'populates an array of gitolite_deploy_keys' do
|
||||
# set_session_user(user)
|
||||
# get :edit,
|
||||
# params: { id: user.id }
|
||||
# expect(assigns(:gitolite_deploy_keys)).to eq [deploy_key]
|
||||
# end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
FactoryBot.define do
|
||||
factory :gitolite_public_key do
|
||||
sequence(:title) { |n| "test-key#{n}" }
|
||||
key { 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDpqFJzsx3wTi3t3X/eOizU6rdtNQoqg5uSjL89F+Ojjm2/sah3ouzx+3E461FDYaoJL58Qs9eRhL+ev0BY7khYXph8nIVDzNEjhLqjevX+YhpaW9Ll7V807CwAyvMNm08aup/NrrlI/jO+At348/ivJrfO7ClcPhq4+Id9RZfvbrKaitGOURD7q6Bd7xjUjELUN8wmYxu5zvx/2n/5woVdBUMXamTPxOY5y6DxTNJ+EYzrCr+bNb7459rWUvBHUQGI2fXDGmFpGiv6ShKRhRtwob1JHI8QC9OtxonrIUesa2dW6RFneUaM7tfRfffC704Uo7yuSswb7YK+p1A9QIt5 nicolas@tchoum' }
|
||||
key_type { 0 }
|
||||
association :user
|
||||
end
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
FactoryBot.define do
|
||||
factory :group do
|
||||
sequence(:lastname) { |n| "GroupTest#{n}" }
|
||||
end
|
||||
end
|
|
@ -1,4 +0,0 @@
|
|||
FactoryBot.define do
|
||||
factory :member do |member|
|
||||
end
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
FactoryBot.define do
|
||||
factory :project do
|
||||
sequence(:identifier) { |n| "project#{n}" }
|
||||
sequence(:name) { |n| "Project#{n}" }
|
||||
end
|
||||
end
|
|
@ -1,11 +0,0 @@
|
|||
FactoryBot.define do
|
||||
factory :protected_branch_user_member, class: 'ProtectedBranchesMember' do
|
||||
association :protected_branch, factory: :repository_protected_branche
|
||||
association :principal, factory: :user
|
||||
end
|
||||
|
||||
factory :protected_branch_group_member, class: 'ProtectedBranchesMember' do
|
||||
association :protected_branch, factory: :repository_protected_branche
|
||||
association :principal, factory: :group
|
||||
end
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
FactoryBot.define do
|
||||
factory :repository_deployment_credential do
|
||||
perm { 'RW+' }
|
||||
association :repository, factory: :repository_gitolite
|
||||
association :user
|
||||
association :gitolite_public_key
|
||||
end
|
||||
end
|
|
@ -1,21 +0,0 @@
|
|||
FactoryBot.define do
|
||||
factory :repository_git_config_key_base, class: 'RepositoryGitConfigKey' do
|
||||
sequence(:key) { |n| "hookfoo.foo#{n}" }
|
||||
value { 'bar' }
|
||||
association :repository, factory: :repository_gitolite
|
||||
end
|
||||
|
||||
factory :repository_git_config_key, class: 'RepositoryGitConfigKey::GitConfig' do
|
||||
sequence(:key) { |n| "hookfoo.foo#{n}" }
|
||||
value { 'bar' }
|
||||
type { 'RepositoryGitConfigKey::GitConfig' }
|
||||
association :repository, factory: :repository_gitolite
|
||||
end
|
||||
|
||||
factory :repository_git_option_key, class: 'RepositoryGitConfigKey::Option' do
|
||||
sequence(:key) { |n| "hookfoo.foo#{n}" }
|
||||
value { 'bar' }
|
||||
type { 'RepositoryGitConfigKey::Option' }
|
||||
association :repository, factory: :repository_gitolite
|
||||
end
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
FactoryBot.define do
|
||||
factory :repository_git_extra do
|
||||
git_http { 0 }
|
||||
default_branch { 'master' }
|
||||
association :repository, factory: :repository_gitolite
|
||||
key { RedmineGitHosting::Utils::Crypto.generate_secret(64) }
|
||||
end
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
FactoryBot.define do
|
||||
factory :repository_gitolite, class: 'Repository::Xitolite' do
|
||||
is_default { false }
|
||||
association :project
|
||||
end
|
||||
end
|
|
@ -1,7 +0,0 @@
|
|||
FactoryBot.define do
|
||||
factory :repository_mirror do
|
||||
sequence(:url) { |n| "ssh://git@example.com:22/john_doe/john_doe/john_doe_#{n}.git" }
|
||||
push_mode { 0 }
|
||||
association :repository, factory: :repository_gitolite
|
||||
end
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
FactoryBot.define do
|
||||
factory :repository_post_receive_url do
|
||||
sequence(:url) { |n| "http://example.com/toto#{n}.php" }
|
||||
association :repository, factory: :repository_gitolite
|
||||
end
|
||||
end
|
|
@ -1,7 +0,0 @@
|
|||
FactoryBot.define do
|
||||
factory :repository_protected_branche do
|
||||
path { 'master' }
|
||||
permissions { 'RW+' }
|
||||
association :repository, factory: :repository_gitolite
|
||||
end
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
FactoryBot.define do
|
||||
factory :repository_svn, class: 'Repository::Subversion' do
|
||||
is_default { false }
|
||||
end
|
||||
end
|
|
@ -1,21 +0,0 @@
|
|||
FactoryBot.define do
|
||||
factory :role do
|
||||
name { 'Manager' }
|
||||
builtin { 0 }
|
||||
issues_visibility { 'all' }
|
||||
position { 1 }
|
||||
permissions do
|
||||
%i[add_project edit_project close_project select_project_modules manage_members
|
||||
manage_versions manage_categories view_issues add_issues edit_issues manage_issue_relations
|
||||
manage_subtasks add_issue_notes move_issues delete_issues view_issue_watchers add_issue_watchers
|
||||
set_issues_private set_notes_private view_private_notes delete_issue_watchers
|
||||
manage_public_queries save_queries view_gantt view_calendar log_time view_time_entries
|
||||
edit_time_entries delete_time_entries manage_news comment_news view_documents
|
||||
add_documents edit_documents delete_documents view_wiki_pages export_wiki_pages
|
||||
view_wiki_edits edit_wiki_pages delete_wiki_pages_attachments protect_wiki_pages
|
||||
delete_wiki_pages rename_wiki_pages add_messages edit_messages delete_messages
|
||||
manage_boards view_files manage_files browse_repository manage_repository view_changesets
|
||||
manage_related_issues manage_project_activities create_gitolite_ssh_key commit_access]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,11 +0,0 @@
|
|||
FactoryBot.define do
|
||||
factory :user do
|
||||
sequence(:login) { |n| "user#{n}" }
|
||||
sequence(:firstname) { |n| "User#{n}" }
|
||||
sequence(:lastname) { |n| "Test#{n}" }
|
||||
sequence(:mail) { |n| "user#{n}@awesome.com" }
|
||||
language { 'fr' }
|
||||
hashed_password { '66eb4812e268747f89ec309178e2ea50410653fb' }
|
||||
salt { '5abd4e59ac0d483daf2f68d3b6544ff3' }
|
||||
end
|
||||
end
|
|
@ -1,225 +0,0 @@
|
|||
---
|
||||
- :before: 349873f6780acce61770d755f460082f939c35de
|
||||
:after: 4754c319e4565d56d1d680e5a67032f38d7b1686
|
||||
:ref: refs/heads/branch1
|
||||
:commits:
|
||||
- :id: 39eec0e81dd0619f2039e19df6d9b62b5740f15c
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:54.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/39eec0e81dd0619f2039e19df6d9b62b5740f15c
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: c6d5b7772692a0c94c2bc49aa0801c004e5a6b73
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:54.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/c6d5b7772692a0c94c2bc49aa0801c004e5a6b73
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 0116d0a680943e6ff5b41aa1b0d0842c39f20458
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:55.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/0116d0a680943e6ff5b41aa1b0d0842c39f20458
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: b914656d7a3de10fa70979771875078ffe7d5f75
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:55.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/b914656d7a3de10fa70979771875078ffe7d5f75
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: a6e1da9c875171bb6f15cf4ec97a2c6b75d43eda
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:55.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/a6e1da9c875171bb6f15cf4ec97a2c6b75d43eda
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 8034f3c4c7c18845c3e4a3bebc6cefc14083cc78
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:55.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/8034f3c4c7c18845c3e4a3bebc6cefc14083cc78
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 4754c319e4565d56d1d680e5a67032f38d7b1686
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:56.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/4754c319e4565d56d1d680e5a67032f38d7b1686
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
:repository:
|
||||
:description: ''
|
||||
:fork: false
|
||||
:forks: 0
|
||||
:homepage: ''
|
||||
:name: test
|
||||
:open_issues: 0
|
||||
:watchers: 0
|
||||
:private: false
|
||||
:url: http://redmine.example.net/projects/test/repository
|
||||
:owner:
|
||||
:name: Redmine
|
||||
:email: redmine@example.net
|
||||
- :before: 1e063b23e50d274bc667808b1273911b7796b583
|
||||
:after: c51932336314bad33b6a2b7d735205a0686442de
|
||||
:ref: refs/heads/branch2
|
||||
:commits:
|
||||
- :id: 4caf42c4681f39e27c08776a0005c24ef4e76515
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:03.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/4caf42c4681f39e27c08776a0005c24ef4e76515
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 95d0cddef1682766cbf28e2b101f5ecc61299b46
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:04.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/95d0cddef1682766cbf28e2b101f5ecc61299b46
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 01e059c50d418da831afdc6175335a86efef4b64
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:04.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/01e059c50d418da831afdc6175335a86efef4b64
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: c794954ac2f31a195557bef66dc5b1e1d9253248
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:04.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/c794954ac2f31a195557bef66dc5b1e1d9253248
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 02b802617b55424a408c4cee9b4c58017d186e4b
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:04.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/02b802617b55424a408c4cee9b4c58017d186e4b
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: ff0ae3c64e48de2b33a511694a72118f12a12951
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:05.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/ff0ae3c64e48de2b33a511694a72118f12a12951
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 7f8af614170833d59ba5d8e09b8aba36f69ac11f
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:05.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/7f8af614170833d59ba5d8e09b8aba36f69ac11f
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 08c1a24b67f6a6113238dfe681ba2c649b678336
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:05.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/08c1a24b67f6a6113238dfe681ba2c649b678336
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 942d348461ebaa47c7bca2874de1556af7b30aea
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:06.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/942d348461ebaa47c7bca2874de1556af7b30aea
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: a96c9d802c0f5ffe42fde052ee9e37ecfb3a8069
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:06.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/a96c9d802c0f5ffe42fde052ee9e37ecfb3a8069
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 5eb8b5a5f2ab6a794974975914cb661f56fe443f
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:06.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/5eb8b5a5f2ab6a794974975914cb661f56fe443f
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: c51932336314bad33b6a2b7d735205a0686442de
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:06.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/c51932336314bad33b6a2b7d735205a0686442de
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
:repository:
|
||||
:description: ''
|
||||
:fork: false
|
||||
:forks: 0
|
||||
:homepage: ''
|
||||
:name: test
|
||||
:open_issues: 0
|
||||
:watchers: 0
|
||||
:private: false
|
||||
:url: http://redmine.example.net/projects/test/repository
|
||||
:owner:
|
||||
:name: Redmine
|
||||
:email: redmine@example.net
|
|
@ -1,322 +0,0 @@
|
|||
---
|
||||
- :before: 349873f6780acce61770d755f460082f939c35de
|
||||
:after: 4754c319e4565d56d1d680e5a67032f38d7b1686
|
||||
:ref: refs/heads/branch1
|
||||
:commits:
|
||||
- :id: 39eec0e81dd0619f2039e19df6d9b62b5740f15c
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:54.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/39eec0e81dd0619f2039e19df6d9b62b5740f15c
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: c6d5b7772692a0c94c2bc49aa0801c004e5a6b73
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:54.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/c6d5b7772692a0c94c2bc49aa0801c004e5a6b73
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 0116d0a680943e6ff5b41aa1b0d0842c39f20458
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:55.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/0116d0a680943e6ff5b41aa1b0d0842c39f20458
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: b914656d7a3de10fa70979771875078ffe7d5f75
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:55.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/b914656d7a3de10fa70979771875078ffe7d5f75
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: a6e1da9c875171bb6f15cf4ec97a2c6b75d43eda
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:55.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/a6e1da9c875171bb6f15cf4ec97a2c6b75d43eda
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 8034f3c4c7c18845c3e4a3bebc6cefc14083cc78
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:55.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/8034f3c4c7c18845c3e4a3bebc6cefc14083cc78
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 4754c319e4565d56d1d680e5a67032f38d7b1686
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:56.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/4754c319e4565d56d1d680e5a67032f38d7b1686
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
:repository:
|
||||
:description: ''
|
||||
:fork: false
|
||||
:forks: 0
|
||||
:homepage: ''
|
||||
:name: test
|
||||
:open_issues: 0
|
||||
:watchers: 0
|
||||
:private: false
|
||||
:url: http://redmine.example.net/projects/test/repository
|
||||
:owner:
|
||||
:name: Redmine
|
||||
:email: redmine@example.net
|
||||
- :before: 1e063b23e50d274bc667808b1273911b7796b583
|
||||
:after: c51932336314bad33b6a2b7d735205a0686442de
|
||||
:ref: refs/heads/branch2
|
||||
:commits:
|
||||
- :id: 4caf42c4681f39e27c08776a0005c24ef4e76515
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:03.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/4caf42c4681f39e27c08776a0005c24ef4e76515
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 95d0cddef1682766cbf28e2b101f5ecc61299b46
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:04.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/95d0cddef1682766cbf28e2b101f5ecc61299b46
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 01e059c50d418da831afdc6175335a86efef4b64
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:04.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/01e059c50d418da831afdc6175335a86efef4b64
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: c794954ac2f31a195557bef66dc5b1e1d9253248
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:04.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/c794954ac2f31a195557bef66dc5b1e1d9253248
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 02b802617b55424a408c4cee9b4c58017d186e4b
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:04.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/02b802617b55424a408c4cee9b4c58017d186e4b
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: ff0ae3c64e48de2b33a511694a72118f12a12951
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:05.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/ff0ae3c64e48de2b33a511694a72118f12a12951
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 7f8af614170833d59ba5d8e09b8aba36f69ac11f
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:05.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/7f8af614170833d59ba5d8e09b8aba36f69ac11f
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 08c1a24b67f6a6113238dfe681ba2c649b678336
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:05.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/08c1a24b67f6a6113238dfe681ba2c649b678336
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 942d348461ebaa47c7bca2874de1556af7b30aea
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:06.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/942d348461ebaa47c7bca2874de1556af7b30aea
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: a96c9d802c0f5ffe42fde052ee9e37ecfb3a8069
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:06.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/a96c9d802c0f5ffe42fde052ee9e37ecfb3a8069
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 5eb8b5a5f2ab6a794974975914cb661f56fe443f
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:06.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/5eb8b5a5f2ab6a794974975914cb661f56fe443f
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: c51932336314bad33b6a2b7d735205a0686442de
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:21:06.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/c51932336314bad33b6a2b7d735205a0686442de
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
:repository:
|
||||
:description: ''
|
||||
:fork: false
|
||||
:forks: 0
|
||||
:homepage: ''
|
||||
:name: test
|
||||
:open_issues: 0
|
||||
:watchers: 0
|
||||
:private: false
|
||||
:url: http://redmine.example.net/projects/test/repository
|
||||
:owner:
|
||||
:name: Redmine
|
||||
:email: redmine@example.net
|
||||
- :before: 410516ba13d39aa719e129804865643b37b2bbcc
|
||||
:after: ba2cd4a1bf6d18fbb89da2b6359f5938289444cb
|
||||
:ref: refs/heads/master
|
||||
:commits:
|
||||
- :id: 16d1777a57eabeae5a3ed7a19da4734b1357bc18
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:41.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/16d1777a57eabeae5a3ed7a19da4734b1357bc18
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: fac18fd941b691493e9d106a726c5ba1b5e05a72
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:42.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/fac18fd941b691493e9d106a726c5ba1b5e05a72
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 50134028ea9b384eab19512e5da762b77425babf
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:42.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/50134028ea9b384eab19512e5da762b77425babf
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 8171ba3fa3370f04afb660216a55407534e57ac0
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:42.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/8171ba3fa3370f04afb660216a55407534e57ac0
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: d698705a10a2db8144781e3e8cb0f0414da7eb40
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:43.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/d698705a10a2db8144781e3e8cb0f0414da7eb40
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 124ba40066c77899de4515577749d7272d43fcbd
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:43.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/124ba40066c77899de4515577749d7272d43fcbd
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 2cc238c9250b90c392f0ab8162842e576cce75c0
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:43.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/2cc238c9250b90c392f0ab8162842e576cce75c0
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: ba2cd4a1bf6d18fbb89da2b6359f5938289444cb
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:43.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/ba2cd4a1bf6d18fbb89da2b6359f5938289444cb
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
:repository:
|
||||
:description: ''
|
||||
:fork: false
|
||||
:forks: 0
|
||||
:homepage: ''
|
||||
:name: test
|
||||
:open_issues: 0
|
||||
:watchers: 0
|
||||
:private: false
|
||||
:url: http://redmine.example.net/projects/test/repository
|
||||
:owner:
|
||||
:name: Redmine
|
||||
:email: redmine@example.net
|
|
@ -1,98 +0,0 @@
|
|||
---
|
||||
- :before: 410516ba13d39aa719e129804865643b37b2bbcc
|
||||
:after: ba2cd4a1bf6d18fbb89da2b6359f5938289444cb
|
||||
:ref: refs/heads/master
|
||||
:commits:
|
||||
- :id: 16d1777a57eabeae5a3ed7a19da4734b1357bc18
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:41.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/16d1777a57eabeae5a3ed7a19da4734b1357bc18
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: fac18fd941b691493e9d106a726c5ba1b5e05a72
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:42.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/fac18fd941b691493e9d106a726c5ba1b5e05a72
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 50134028ea9b384eab19512e5da762b77425babf
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:42.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/50134028ea9b384eab19512e5da762b77425babf
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 8171ba3fa3370f04afb660216a55407534e57ac0
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:42.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/8171ba3fa3370f04afb660216a55407534e57ac0
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: d698705a10a2db8144781e3e8cb0f0414da7eb40
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:43.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/d698705a10a2db8144781e3e8cb0f0414da7eb40
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 124ba40066c77899de4515577749d7272d43fcbd
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:43.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/124ba40066c77899de4515577749d7272d43fcbd
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: 2cc238c9250b90c392f0ab8162842e576cce75c0
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:43.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/2cc238c9250b90c392f0ab8162842e576cce75c0
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
- :id: ba2cd4a1bf6d18fbb89da2b6359f5938289444cb
|
||||
:message: test
|
||||
:timestamp: 2014-05-22 21:20:43.000000000 Z
|
||||
:added: []
|
||||
:modified: []
|
||||
:removed: []
|
||||
:url: http://redmine.example.net/projects/test/repository/revisions/ba2cd4a1bf6d18fbb89da2b6359f5938289444cb
|
||||
:author:
|
||||
:name: Nicolas
|
||||
:email: nrodriguez@jbox-web.com
|
||||
:repository:
|
||||
:description: ''
|
||||
:fork: false
|
||||
:forks: 0
|
||||
:homepage: ''
|
||||
:name: test
|
||||
:open_issues: 0
|
||||
:watchers: 0
|
||||
:private: false
|
||||
:url: http://redmine.example.net/projects/test/repository
|
||||
:owner:
|
||||
:name: Redmine
|
||||
:email: redmine@example.net
|
|
@ -1,40 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
describe GitolitePublicKeysHelper do
|
||||
TEST_KEY = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCpOU1DzQzU4/acdt3wWhk43acGs3Jp7jVlnEtc+2C8QFAUiJMrAOzyUnEliwxarGonJ5gKbI9NkqqPpz9LATBQw382+3FjAlptgqn7eGBih0DgwN6wdHflTRdE6sRn7hxB5h50p547n26FpbX9GSOHPhgxSnyvGXnC+YZyTfMiw5JMhw68SfLS8YENrXukg2ItJPspn6mPqIHrcM2NJOG4Bm+1ibYpDfrWJqYp3Q6disgwrsN08pS6lDfoQRiRHXg8WFbQbHloVaYFpdT6VoBQiAydeSpDSYTBJd/v3qTpK8aheC8sdnrddZf1T6L51z7WZ6vPVKQYPjpAxZ4p6eef nicolas@tchoum'
|
||||
|
||||
# before(:all) do
|
||||
# @admin_user = create_admin_user
|
||||
# @user_without_perm = create_anonymous_user
|
||||
# @user_with_perm = create_user_with_permissions(FactoryBot.create(:project), permissions: [:create_repository_deployment_credentials])
|
||||
# @gitolite_public_key = create_ssh_key(user_id: @user_without_perm.id, key_type: 1, title: 'foo1', key: TEST_KEY)
|
||||
# end
|
||||
|
||||
# describe '.keylabel' do
|
||||
# context 'when current user is the key owner' do
|
||||
# before { User.current = @user_without_perm }
|
||||
|
||||
# it { expect(helper.keylabel(@gitolite_public_key)).to eq 'foo1' }
|
||||
# end
|
||||
|
||||
# context 'when current user is not the key owner' do
|
||||
# before { User.current = @admin_user }
|
||||
|
||||
# it { expect(helper.keylabel(@gitolite_public_key)).to eq 'git_anonymous@foo1' }
|
||||
# end
|
||||
# end
|
||||
|
||||
# describe '.can_create_deployment_keys_for_some_project' do
|
||||
# context 'when current user is admin' do
|
||||
# it { expect(helper.can_create_deployment_keys_for_some_project(@admin_user)).to eq true }
|
||||
# end
|
||||
|
||||
# context 'when current user can create_deployment_keys' do
|
||||
# it { expect(helper.can_create_deployment_keys_for_some_project(@user_with_perm)).to eq true }
|
||||
# end
|
||||
|
||||
# context 'when current user cannot create_deployment_keys' do
|
||||
# it { expect(helper.can_create_deployment_keys_for_some_project(@user_without_perm)).to eq false }
|
||||
# end
|
||||
# end
|
||||
end
|
|
@ -1,28 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
||||
|
||||
describe RedmineGitHosting::Config do
|
||||
GITOLITE_VERSION_2 = [
|
||||
'hello redmine_gitolite_admin_id_rsa, this is gitolite v2.3.1-0-g912a8bd-dt running on git 1.7.2.5',
|
||||
'hello gitolite_admin_id_rsa, this is gitolite gitolite-2.3.1 running on git 1.8.1.5',
|
||||
'hello gitolite_admin_id_rsa, this is gitolite 2.3.1-1.el6 running on git 1.7.1',
|
||||
'hello gitolite_admin_id_rsa, this is gitolite 2.2-1 (Debian) running on git 1.7.9.5'
|
||||
]
|
||||
|
||||
GITOLITE_VERSION_3 = [
|
||||
'hello redmine_gitolite_admin_id_rsa, this is git@dev running gitolite3 v3.3-11-ga1aba93 on git 1.7.2.5'
|
||||
]
|
||||
|
||||
GITOLITE_VERSION_2.each do |gitolite_version|
|
||||
it 'should recognize Gitolite2' do
|
||||
version = RedmineGitHosting::Config.find_version(gitolite_version)
|
||||
expect(version).to eq 2
|
||||
end
|
||||
end
|
||||
|
||||
GITOLITE_VERSION_3.each do |gitolite_version|
|
||||
it 'should recognize Gitolite3' do
|
||||
version = RedmineGitHosting::Config.find_version(gitolite_version)
|
||||
expect(version).to eq 3
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,29 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
||||
|
||||
describe RedmineGitHosting::Utils::Git do
|
||||
include RedmineGitHosting::Utils::Git
|
||||
|
||||
describe '.parse_refspec' do
|
||||
context 'it should accept different refspec format' do
|
||||
it 'should accept <name>' do
|
||||
expect(parse_refspec('dev')).to eq ({ type: nil, name: 'dev' })
|
||||
end
|
||||
|
||||
it 'should accept a branch path' do
|
||||
expect(parse_refspec('refs/branches/dev')).to eq ({ type: 'branches', name: 'dev' })
|
||||
end
|
||||
|
||||
it 'should accept the wildcard param (*)' do
|
||||
expect(parse_refspec('refs/branches/dev/*')).to eq ({ type: 'branches', name: 'dev/*' })
|
||||
expect(parse_refspec('refs/tags/*')).to eq ({ type: 'tags', name: '*' })
|
||||
end
|
||||
|
||||
it 'should parse different refspec path' do
|
||||
expect(parse_refspec('refs/remotes/origin/experiment/*')).to eq ({ type: 'remotes', name: 'origin/experiment/*' })
|
||||
expect(parse_refspec('refs/remotes/origin/experiment/master')).to eq ({ type: 'remotes', name: 'origin/experiment/master' })
|
||||
expect(parse_refspec('refs/remotes/origin/experiment')).to eq ({ type: 'remotes', name: 'origin/experiment' })
|
||||
expect(parse_refspec('refs/heads/experiment')).to eq ({ type: 'heads', name: 'experiment' })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,258 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
describe GitolitePublicKey do
|
||||
SSH_KEY_0 = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDpqFJzsx3wTi3t3X/eOizU6rdtNQoqg5uSjL89F+Ojjm2/sah3ouzx+3E461FDYaoJL58Qs9eRhL+ev0BY7khYXph8nIVDzNEjhLqjevX+YhpaW9Ll7V807CwAyvMNm08aup/NrrlI/jO+At348/ivJrfO7ClcPhq4+Id9RZfvbrKaitGOURD7q6Bd7xjUjELUN8wmYxu5zvx/2n/5woVdBUMXamTPxOY5y6DxTNJ+EYzrCr+bNb7459rWUvBHUQGI2fXDGmFpGiv6ShKRhRtwob1JHI8QC9OtxonrIUesa2dW6RFneUaM7tfRfffC704Uo7yuSswb7YK+p1A9QIt5 nicolas@tchoum'
|
||||
SSH_KEY_1 = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCz0pLXcQWS4gLUimUSLwDOvEmQF8l8EKoj0LjxOyM3y2dpLsn0aiqS0ecA0G/ROomaawop8EZGFetoJKJM468OZlx2aKoQemzvFIq0Mn1ZhcrlA1alAsDYqzZI8iHO4JIS3YbeLLkVGAlYA+bmA5enXN9mGhC9cgoMC79EZiLD9XvOw4iXDjqXaCzFZHU1shMWwaJfpyxBm+Mxs2vtZzwETDqeu9rohNMl60dODf6+JoXYiahP+B+P2iKlL7ORb1YsAH/4ZMsVgRckj8snb4uc3XgwLRNNw+oB78ApZGr0j3Zc32U9rpmulbHIroWO07OV4Xsplnu8lhGvfodA2gjb nicolas@tchoum'
|
||||
SSH_KEY_2 = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5+JfM82k03J98GWL6ghJ4TYM8DbvDnVh1s1rUDNlM/1U5rwbgXHOR4xV3lulgYEYRtYeMoL3rt4ZpEyXWkOreOVsUlkW66SZJR5aGVTNJOLX7HruEDqj7RWlt0u0MH6DgBVAJimQrxYN50jYD4XnDUjb/qv55EhPvbJ3jcAb3zuyRXMKZYGNVzVFLUagbvVaOwR23csWSLDTsAEI9JzaxMKvCNRwk3jFepiCovXbw+g0iyvJdp0+AJpC57ZupyxHeX9J2oz7im2UaHHqLa2qUZL6c4PNV/D2p0Bts4Tcnn3OFPL90RF/ao0tjiUFxM3ti8pRHOqRcZHcOgIhKiaLX nicolas@tchoum'
|
||||
SSH_KEY_3 = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/pSRh11xbadAh24fQlc0i0dneG0lI+DCkng+bVmumgRvfD0w79vcJ2U1qir2ChjpNvi2n96HUGIEGNV60/VG05JY70mEb//YVBmQ3w0QPO7toEWNms9SQlwR0PN6tarATumFik4MI+8M23P6W8O8OYwsnMmYwaiEU5hDopH88x74MQKjPiRSrhMkGiThMZhLVK6j8yfNPoj9yUxPBWc7zsMCC2uAOfR5Fg6hl2TKGxTi0vecTh1csDcO2agXx42RRiZeIQbv9j0IJjVL8KhXvbndVnJRjGGbxQFAedicw8OrPH7jz6NimmaTooqU9SwaPInK/x3omd297/zzcQm3p nicolas@tchoum'
|
||||
SSH_KEY_4 = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDCScLGus1vrZ9OyzOj3TtYa+IHUp5V+2hwcMW7pphGIAPRi5Pe6GwSbSV5GnanerOH9ucmEREaCIdGOzO2zVI35e3RD6wTeW28Ck7JN1r2LSgSvXGvxGyzu0H4Abf66Kajt+lN0/71tbFtoTaJTGSYE3W0rNU6OQBvHf1o4wIyBEFm3cu+e2OrmW/nVIqk8hCN2cU/0OutOWT+vaRLbIU3VQmHftqa4NVxdc4OG48vpZxlJwKexqAHj8Ok/sn3k4CIo8zR0vRaeGPqAmOpm84uEfRWoA71NNS4tIhENlikuD5SJIdyXE9d8CwGTth4jP9/BNT0y4C8cGYljjUWkx3v nicolas@tchoum'
|
||||
|
||||
before(:all) do
|
||||
@user1 = create_user('git_user1')
|
||||
@user2 = create_user('git_user2')
|
||||
end
|
||||
|
||||
# There is an isolation issue in tests.
|
||||
# Try to workaround it...
|
||||
def test_user
|
||||
'redmine_git_user1_12'
|
||||
end
|
||||
|
||||
describe 'Valid SSH key build' do
|
||||
before(:each) do
|
||||
@ssh_key = build_ssh_key(title: 'test-key')
|
||||
end
|
||||
|
||||
subject { @ssh_key }
|
||||
|
||||
## Relations
|
||||
it { is_expected.to belong_to(:user) }
|
||||
it { is_expected.to have_many(:repository_deployment_credentials) }
|
||||
|
||||
## Validations
|
||||
it { is_expected.to be_valid }
|
||||
|
||||
it { is_expected.to validate_presence_of(:title) }
|
||||
it { is_expected.to validate_presence_of(:user_id) }
|
||||
it { is_expected.to validate_presence_of(:key) }
|
||||
it { is_expected.to validate_presence_of(:key_type) }
|
||||
|
||||
it { is_expected.to validate_numericality_of(:key_type) }
|
||||
|
||||
it { is_expected.to validate_inclusion_of(:key_type).in_array(%w[0 1]) }
|
||||
|
||||
it { is_expected.to ensure_length_of(:title).is_at_most(60) }
|
||||
|
||||
it { is_expected.not_to allow_value('toto@toto', 'ma_clé').for(:title) }
|
||||
|
||||
it { is_expected.to respond_to(:identifier) }
|
||||
it { is_expected.to respond_to(:fingerprint) }
|
||||
it { is_expected.to respond_to(:owner) }
|
||||
it { is_expected.to respond_to(:location) }
|
||||
it { is_expected.to respond_to(:gitolite_path) }
|
||||
it { is_expected.to respond_to(:data_for_destruction) }
|
||||
|
||||
## Attributes content
|
||||
it 'can render as string' do
|
||||
expect(@ssh_key.to_s).to eq 'test-key'
|
||||
end
|
||||
|
||||
it 'has a title' do
|
||||
expect(@ssh_key.title).to eq 'test-key'
|
||||
end
|
||||
|
||||
it 'is a user key' do
|
||||
expect(@ssh_key.user_key?).to be true
|
||||
end
|
||||
|
||||
it 'is not a deploy key' do
|
||||
expect(@ssh_key.deploy_key?).to be false
|
||||
end
|
||||
|
||||
it 'must be deleted when unused' do
|
||||
expect(@ssh_key.delete_when_unused?).to be true
|
||||
end
|
||||
|
||||
## Test data integrity
|
||||
it 'should not truncate key' do
|
||||
expect(@ssh_key.key.length).to be == SSH_KEY_0.length
|
||||
end
|
||||
|
||||
## Test change validation
|
||||
describe 'when delete_when_unused is false' do
|
||||
it 'should not be deleted when unused' do
|
||||
@ssh_key.delete_when_unused = false
|
||||
expect(@ssh_key.delete_when_unused?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when delete_when_unused is true' do
|
||||
it 'should be deleted when unused' do
|
||||
@ssh_key.delete_when_unused = true
|
||||
expect(@ssh_key.delete_when_unused?).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'Valid SSH key creation' do
|
||||
let(:ssh_key) { create_ssh_key(user_id: @user1.id, title: 'test-key') }
|
||||
|
||||
subject { ssh_key }
|
||||
|
||||
it 'has an identifier' do
|
||||
expect(ssh_key.identifier).to eq "#{test_user}@redmine_test_key"
|
||||
end
|
||||
|
||||
it 'has a fingerprint' do
|
||||
expect(ssh_key.fingerprint).to eq "SHA256:VgXjWgUbURtD6go5HV7Eop2UqVjmIAI68shaB66yv+c"
|
||||
end
|
||||
|
||||
it 'has a owner' do
|
||||
expect(ssh_key.owner).to eq test_user
|
||||
end
|
||||
|
||||
it 'has a location' do
|
||||
expect(ssh_key.location).to eq 'redmine_test_key'
|
||||
end
|
||||
|
||||
it 'has a gitolite_path' do
|
||||
expect(ssh_key.gitolite_path).to eq "keydir/redmine_git_hosting/#{test_user}/redmine_test_key/#{test_user}.pub"
|
||||
end
|
||||
|
||||
it 'it has data hash for destruction' do
|
||||
valid_hash = { key: SSH_KEY_0, location: 'redmine_test_key', owner: test_user, title: "#{test_user}@redmine_test_key" }
|
||||
expect(ssh_key.data_for_destruction).to eq valid_hash
|
||||
end
|
||||
|
||||
context 'when identifier is changed' do
|
||||
before { ssh_key.identifier = 'foo' }
|
||||
|
||||
it { is_expected.not_to be_valid }
|
||||
end
|
||||
|
||||
context 'when key is changed' do
|
||||
before { ssh_key.key = 'foo' }
|
||||
|
||||
it { is_expected.not_to be_valid }
|
||||
end
|
||||
|
||||
context 'when user_id is changed' do
|
||||
before { ssh_key.user_id = @user2.id }
|
||||
|
||||
it { is_expected.not_to be_valid }
|
||||
end
|
||||
|
||||
context 'when key_type is changed' do
|
||||
before { ssh_key.key_type = 1 }
|
||||
|
||||
it { is_expected.not_to be_valid }
|
||||
end
|
||||
|
||||
# Test reset_identifiers
|
||||
context 'when identifiers are reset' do
|
||||
before do
|
||||
@old_identifier = ssh_key.identifier
|
||||
@old_fingerprint = ssh_key.fingerprint
|
||||
|
||||
ssh_key.reset_identifiers
|
||||
end
|
||||
|
||||
it { is_expected.to be_valid }
|
||||
|
||||
it 'should have the same identifier' do
|
||||
expect(ssh_key.identifier).to eq @old_identifier
|
||||
end
|
||||
|
||||
it 'should have the same fingerprint' do
|
||||
expect(ssh_key.fingerprint).to eq @old_fingerprint
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'Valid SSH key format' do
|
||||
describe 'when ssh key format is valid' do
|
||||
ssh_keys = [
|
||||
'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/Ec2gummukPxlpPHZ7K96iBdG5n8v0PJEDvTVZRRFlS0QYa407gj9HuMrPjwEfVHqy+3KZmvKLWQBsSlf0Fn+eAPgnoqwVfZaJnfgkSxJiAzRraKQZX1m2wx2SVMfjw7/1j59zV60UhFiwEQ3Eqlg3xjQmjvrwDM+SoshrWB+TeqwO/K+QEP1ZbURYoCxc92GrLYWKixsAov/zr0loXqul9fydZcWwJE3H/BWC7PTtn4jfjG9+9F+SZ0OMwQvSGKhVlj3GBDtaDBnsuoHGh/CA2W240nwpQysG2BJ5DWXu6vKbjNn6uV91wXeKDEDpuWqv5Vi2XAxGTWKc5lF0IJ5 nicolas@tchoum',
|
||||
'ssh-dss AAAAB3NzaC1kc3MAAACBAKscxrmjRgXtb0ZUaaBUteBtF2cI0vStnni9KVQd94L8qqxvKLbDl5JTKjUvG2s7rD4sVRzBoTkuDGb7OZLf56wJyF3k+k8uNRJzvH/CZbkKM2hjuRVYVort1EwcH7JiEQr7bCLe7MRaltuo/M1vhapwy7fhKxAo9YoYVWiGoFTVAAAAFQDPywT8yFDahFvxtt/95Q9Emq8R7QAAAIBHYnvt3hT9NYy+nOuZG+cQTz0hnVzUIWuj0XF2iyx52s2eSmF0HxIsZ0D9g2A0L1Xr/vlkWBMq/zJZJgJw2Ifys8L47HzjhL8K0Skdm23Z6rQR9hlOEZ5Rcank98U6VRYPWpYk7OLdRDruwXb+Ms5YhIztxsGO3YfRBdSBrW4DMAAAAIAJmmwivw3XoFP6C97LB+tJAjWRYJHpiDwOWNDKu0dZewUzUAo40NuHNgKJS2nsxW0sphaeMtf70IbvDsFQG45I+G2dlt+s19t4YCbVcz7xrw7LceEz+f0UR2/Z+LIK2GPIIoyymOq/kIIxni3xgKDl4mvvt45TTsQzs0zhkmEy/g== nicolas@tchoum',
|
||||
'ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLIcYw8NbJc28tDsC+8sf/o14hQmQfdC31OFP0eb5qFVRgEjMJ9mwolqWIW+AcbIAhX2GJVdTLZoUJj6T5PiUtM= nicolas@tchoum'
|
||||
]
|
||||
|
||||
ssh_keys.each do |valid_key|
|
||||
it 'should be valid' do
|
||||
expect(build_ssh_key(key: valid_key)).to be_valid
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context 'when SSH key already exist' do
|
||||
before { create_ssh_key(user_id: @user1.id, title: 'test-key2') }
|
||||
|
||||
## Test uniqueness validation
|
||||
context 'and title is already taken' do
|
||||
it { expect(build_ssh_key(user_id: @user1.id, title: 'test-key2', key: SSH_KEY_1)).not_to be_valid }
|
||||
end
|
||||
|
||||
context 'and is already taken by someone' do
|
||||
it { expect(build_ssh_key(user_id: @user1.id, title: 'foo')).not_to be_valid }
|
||||
end
|
||||
|
||||
context 'and is already taken by current user' do
|
||||
it 'should_not be_valid' do
|
||||
User.current = @user1
|
||||
expect(build_ssh_key(user_id: @user1.id, title: 'foo')).not_to be_valid
|
||||
end
|
||||
end
|
||||
|
||||
context 'and is already taken by other user and current user is admin' do
|
||||
it 'should_not be_valid' do
|
||||
@user2.admin = true
|
||||
User.current = @user2
|
||||
expect(build_ssh_key(user_id: @user1.id, title: 'foo')).not_to be_valid
|
||||
end
|
||||
end
|
||||
|
||||
context 'and is already taken by other user and current user is not admin' do
|
||||
it 'should_not be_valid' do
|
||||
User.current = @user2
|
||||
expect(build_ssh_key(user_id: @user1.id, title: 'foo')).not_to be_valid
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when Gitolite Admin ssh key is reused' do
|
||||
it 'should not be valid' do
|
||||
expect(build_ssh_key(user_id: @user1.id, title: 'foo', key: File.read(RedmineGitHosting::Config.gitolite_ssh_public_key))).not_to be_valid
|
||||
end
|
||||
end
|
||||
|
||||
context 'when many keys are saved' do
|
||||
before do
|
||||
create_ssh_key(user: @user1, title: 'active1', key: SSH_KEY_1, key_type: 1)
|
||||
create_ssh_key(user: @user1, title: 'active2', key: SSH_KEY_2, key_type: 1)
|
||||
create_ssh_key(user: @user2, title: 'active3', key: SSH_KEY_3)
|
||||
create_ssh_key(user: @user2, title: 'active4', key: SSH_KEY_4)
|
||||
end
|
||||
|
||||
it 'should have 6 keys' do
|
||||
expect(GitolitePublicKey.all.length).to be == 5
|
||||
end
|
||||
|
||||
it 'should have 2 user keys' do
|
||||
expect(GitolitePublicKey.user_key.length).to be == 2
|
||||
end
|
||||
|
||||
it 'should have 4 deploy keys' do
|
||||
expect(GitolitePublicKey.deploy_key.length).to be == 3
|
||||
end
|
||||
|
||||
it 'user1 should have 2 keys' do
|
||||
expect(@user1.gitolite_public_keys.length).to be == 2
|
||||
end
|
||||
|
||||
it 'user2 should have 2 keys' do
|
||||
expect(@user2.gitolite_public_keys.length).to be == 2
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,10 +0,0 @@
|
|||
require File.expand_path('../spec_helper', __dir__)
|
||||
|
||||
describe Group do
|
||||
subject { group }
|
||||
|
||||
let(:group) { build(:group) }
|
||||
|
||||
it { is_expected.to have_many(:protected_branches_members).dependent(:destroy) }
|
||||
it { is_expected.to have_many(:protected_branches).through(:protected_branches_members) }
|
||||
end
|
|
@ -1,38 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
describe Project do
|
||||
|
||||
before(:all) do
|
||||
@project = create(:project)
|
||||
@git_repo_1 = create_git_repository(project: @project, is_default: true)
|
||||
@git_repo_2 = create_git_repository(project: @project, identifier: 'git-repo-test')
|
||||
@svn_repo_1 = create_svn_repository(project: @project, identifier: 'svn-repo-test', url: 'http://svn-repo-test')
|
||||
end
|
||||
|
||||
subject { @project }
|
||||
|
||||
## Test relations
|
||||
it { should respond_to(:gitolite_repos) }
|
||||
it { should respond_to(:repo_blank_ident) }
|
||||
|
||||
it 'should have 1 repository with blank ident' do
|
||||
expect(@project.repo_blank_ident).to eq @git_repo_1
|
||||
end
|
||||
|
||||
it 'should have 2 Git repositories' do
|
||||
expect(@project.gitolite_repos).to include @git_repo_1, @git_repo_2
|
||||
end
|
||||
|
||||
it 'should have 3 repositories' do
|
||||
expect(@project.repositories).to include @git_repo_1, @git_repo_2, @svn_repo_1
|
||||
end
|
||||
|
||||
it 'should not match existing repository identifier' do
|
||||
expect(build(:project, identifier: 'git-repo-test')).to be_invalid
|
||||
end
|
||||
|
||||
it 'should not match Gitolite Admin repository identifier' do
|
||||
expect(build(:project, identifier: 'gitolite-admin')).to be_invalid
|
||||
end
|
||||
|
||||
end
|
|
@ -1,70 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
describe RepositoryDeploymentCredential do
|
||||
|
||||
DEPLOY_KEY = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCz0pLXcQWS4gLUimUSLwDOvEmQF8l8EKoj0LjxOyM3y2dpLsn0aiqS0ecA0G/ROomaawop8EZGFetoJKJM468OZlx2aKoQemzvFIq0Mn1ZhcrlA1alAsDYqzZI8iHO4JIS3YbeLLkVGAlYA+bmA5enXN9mGhC9cgoMC79EZiLD9XvOw4iXDjqXaCzFZHU1shMWwaJfpyxBm+Mxs2vtZzwETDqeu9rohNMl60dODf6+JoXYiahP+B+P2iKlL7ORb1YsAH/4ZMsVgRckj8snb4uc3XgwLRNNw+oB78ApZGr0j3Zc32U9rpmulbHIroWO07OV4Xsplnu8lhGvfodA2gjb nicolas@tchoum'
|
||||
USER_KEY = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5+JfM82k03J98GWL6ghJ4TYM8DbvDnVh1s1rUDNlM/1U5rwbgXHOR4xV3lulgYEYRtYeMoL3rt4ZpEyXWkOreOVsUlkW66SZJR5aGVTNJOLX7HruEDqj7RWlt0u0MH6DgBVAJimQrxYN50jYD4XnDUjb/qv55EhPvbJ3jcAb3zuyRXMKZYGNVzVFLUagbvVaOwR23csWSLDTsAEI9JzaxMKvCNRwk3jFepiCovXbw+g0iyvJdp0+AJpC57ZupyxHeX9J2oz7im2UaHHqLa2qUZL6c4PNV/D2p0Bts4Tcnn3OFPL90RF/ao0tjiUFxM3ti8pRHOqRcZHcOgIhKiaLX nicolas@tchoum'
|
||||
|
||||
before(:all) do
|
||||
users = create_list(:user, 2)
|
||||
@user1 = users[0]
|
||||
@user2 = users[1]
|
||||
|
||||
@deploy_key = create(:gitolite_public_key, user: @user1, key_type: 1, title: 'foo1', key: DEPLOY_KEY)
|
||||
@user_key = create(:gitolite_public_key, user: @user1, key_type: 0, title: 'foo2', key: USER_KEY)
|
||||
end
|
||||
|
||||
|
||||
def build_deployment_credential(opts = {})
|
||||
build(:repository_deployment_credential, opts)
|
||||
end
|
||||
|
||||
|
||||
describe 'Valid RepositoryDeploymentCredential creation' do
|
||||
before(:each) do
|
||||
@deployment_credential = build_deployment_credential(user: @user1, gitolite_public_key: @deploy_key)
|
||||
end
|
||||
|
||||
subject { @deployment_credential }
|
||||
|
||||
## Relations
|
||||
it { should belong_to(:repository) }
|
||||
it { should belong_to(:gitolite_public_key) }
|
||||
it { should belong_to(:user) }
|
||||
|
||||
## Validations
|
||||
it { should be_valid }
|
||||
|
||||
it { should validate_presence_of(:repository_id) }
|
||||
it { should validate_presence_of(:gitolite_public_key_id) }
|
||||
it { should validate_presence_of(:user_id) }
|
||||
it { should validate_presence_of(:perm) }
|
||||
|
||||
it { should validate_inclusion_of(:perm).in_array(%w(R RW+)) }
|
||||
|
||||
## Attributes content
|
||||
it 'is a active credential' do
|
||||
expect(@deployment_credential.active?).to be true
|
||||
end
|
||||
|
||||
describe 'when active is false' do
|
||||
before { @deployment_credential.active = false }
|
||||
it 'shoud be inactive' do
|
||||
expect(@deployment_credential.active?).to be false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when key is not a deployment key' do
|
||||
it 'should not be valid' do
|
||||
expect(build_deployment_credential(user: @user1, gitolite_public_key: @user_key)).not_to be_valid
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user id is not the owner of deployment key' do
|
||||
it 'should not be valid' do
|
||||
expect(build_deployment_credential(user: @user2, gitolite_public_key: @user_key)).not_to be_valid
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -1,26 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
||||
|
||||
describe RepositoryGitConfigKey::GitConfig do
|
||||
before(:each) do
|
||||
@git_config_key = build(:repository_git_config_key)
|
||||
end
|
||||
|
||||
subject { @git_config_key }
|
||||
|
||||
## Validations
|
||||
it { should be_valid }
|
||||
it { should validate_presence_of(:key) }
|
||||
it { should validate_uniqueness_of(:key).scoped_to(:repository_id) }
|
||||
it { should allow_value('hookfoo.foo', 'hookfoo.foo.bar').for(:key) }
|
||||
it { should_not allow_value('hookfoo').for(:key) }
|
||||
|
||||
context 'when key is updated' do
|
||||
before do
|
||||
@git_config_key.save
|
||||
@git_config_key.key = 'hookbar.foo'
|
||||
@git_config_key.save
|
||||
end
|
||||
|
||||
it { should be_valid }
|
||||
end
|
||||
end
|
|
@ -1,26 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
||||
|
||||
describe RepositoryGitConfigKey::Option do
|
||||
before(:each) do
|
||||
@git_config_key = build(:repository_git_option_key)
|
||||
end
|
||||
|
||||
subject { @git_config_key }
|
||||
|
||||
## Validations
|
||||
it { should be_valid }
|
||||
it { should validate_presence_of(:key) }
|
||||
it { should validate_uniqueness_of(:key).scoped_to(:repository_id) }
|
||||
it { should allow_value('hookfoo', 'hookfoo.foo', 'hookfoo.foo.bar').for(:key) }
|
||||
|
||||
|
||||
context 'when key is updated' do
|
||||
before do
|
||||
@git_config_key.save
|
||||
@git_config_key.key = 'hookbar.foo'
|
||||
@git_config_key.save
|
||||
end
|
||||
|
||||
it { should be_valid }
|
||||
end
|
||||
end
|
|
@ -1,15 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
describe RepositoryGitConfigKey do
|
||||
|
||||
let(:git_config_key) { build(:repository_git_config_key_base) }
|
||||
|
||||
subject { git_config_key }
|
||||
|
||||
## Relations
|
||||
it { should belong_to(:repository) }
|
||||
|
||||
## Validations
|
||||
it { should validate_presence_of(:repository_id) }
|
||||
it { should validate_presence_of(:value) }
|
||||
end
|
|
@ -1,78 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
describe RepositoryGitExtra do
|
||||
|
||||
let(:git_extra) { build(:repository_git_extra) }
|
||||
|
||||
subject { git_extra }
|
||||
|
||||
## Relations
|
||||
it { should belong_to(:repository) }
|
||||
|
||||
## Validations
|
||||
it { should be_valid }
|
||||
|
||||
it { should validate_presence_of(:repository_id) }
|
||||
it { should validate_presence_of(:default_branch) }
|
||||
it { should validate_presence_of(:key) }
|
||||
|
||||
it { should validate_uniqueness_of(:repository_id) }
|
||||
|
||||
## Serializations
|
||||
# it { should serialize(:urls_order) }
|
||||
|
||||
|
||||
describe '#git_daemon' do
|
||||
it 'should return the value for git_daemon' do
|
||||
expect(git_extra.git_daemon).to be true
|
||||
end
|
||||
end
|
||||
|
||||
describe '#git_http' do
|
||||
it 'should return the value for git_http' do
|
||||
expect(git_extra.git_http).to be false
|
||||
end
|
||||
end
|
||||
|
||||
describe '#git_https' do
|
||||
it 'should return the value for git_https' do
|
||||
expect(git_extra.git_https).to be false
|
||||
end
|
||||
end
|
||||
|
||||
describe '#git_go' do
|
||||
it 'should return the value for git_go' do
|
||||
expect(git_extra.git_go).to be false
|
||||
end
|
||||
end
|
||||
|
||||
describe '#git_ssh' do
|
||||
it 'should return the value for git_ssh' do
|
||||
expect(git_extra.git_ssh).to be true
|
||||
end
|
||||
end
|
||||
|
||||
describe '#git_notify' do
|
||||
it 'should return the value for git_notify' do
|
||||
expect(git_extra.git_notify).to be true
|
||||
end
|
||||
end
|
||||
|
||||
describe '#default_branch' do
|
||||
it 'should return the value for default_branch' do
|
||||
expect(git_extra.default_branch).to eq 'master'
|
||||
end
|
||||
end
|
||||
|
||||
describe '#protected_branch' do
|
||||
it 'should return the value for protected_branch' do
|
||||
expect(git_extra.protected_branch).to be false
|
||||
end
|
||||
end
|
||||
|
||||
describe '#key' do
|
||||
it 'should return the value for key' do
|
||||
expect(git_extra.key).to match /\A[a-zA-Z0-9]+\z/
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,165 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
describe RepositoryMirror do
|
||||
|
||||
VALID_URLS = [
|
||||
'ssh://user@host.xz:2222/path/to/repo.git',
|
||||
'ssh://user@host.xz/path/to/repo.git',
|
||||
'ssh://user-name@long.host-domain.xz/path.git',
|
||||
'ssh://host.xz:2222/path/to/repo.git',
|
||||
'ssh://host.xz/path/to/repo.git',
|
||||
'ssh://user@host.xz/path/to/repo.git',
|
||||
'ssh://host.xz/path/to/repo.git',
|
||||
'ssh://user@host.xz/~user/path/to/repo.git',
|
||||
'ssh://host.xz/~user/path/to/repo.git',
|
||||
'ssh://user@host.xz/~/path/to/repo.git',
|
||||
'ssh://host.xz/~/path/to/repo.git',
|
||||
'ssh://host.xz/~/path.to/repo.git'
|
||||
]
|
||||
|
||||
|
||||
def build_mirror(opts = {})
|
||||
build(:repository_mirror, opts)
|
||||
end
|
||||
|
||||
|
||||
def expect_invalid_refspec(refspec)
|
||||
expect(build_mirror(push_mode: 1, explicit_refspec: refspec)).not_to be_valid
|
||||
end
|
||||
|
||||
|
||||
def expect_valid_refspec(refspec)
|
||||
expect(build_mirror(push_mode: 1, explicit_refspec: refspec)).to be_valid
|
||||
end
|
||||
|
||||
|
||||
describe 'Valid RepositoryMirror creation' do
|
||||
before(:each) do
|
||||
@mirror = build(:repository_mirror)
|
||||
end
|
||||
|
||||
subject { @mirror }
|
||||
|
||||
## Relations
|
||||
it { should belong_to(:repository) }
|
||||
|
||||
## Validations
|
||||
it { should be_valid }
|
||||
|
||||
it { should validate_presence_of(:repository_id) }
|
||||
it { should validate_presence_of(:url) }
|
||||
it { should validate_presence_of(:push_mode) }
|
||||
|
||||
it { should validate_uniqueness_of(:url).scoped_to(:repository_id) }
|
||||
|
||||
it { should allow_value(*VALID_URLS).for(:url) }
|
||||
|
||||
it { should validate_numericality_of(:push_mode) }
|
||||
|
||||
it { should validate_inclusion_of(:push_mode).in_array(%w(0 1 2)) }
|
||||
|
||||
## Attributes content
|
||||
it { expect(@mirror.active).to be true }
|
||||
it { expect(@mirror.include_all_branches).to be false }
|
||||
it { expect(@mirror.include_all_tags).to be false }
|
||||
it { expect(@mirror.explicit_refspec).to eq '' }
|
||||
it { expect(@mirror.push_mode).to eq 0 }
|
||||
it { expect(@mirror.push_mode).to be_a(Integer) }
|
||||
|
||||
## Test changes
|
||||
describe 'when active is true' do
|
||||
before { @mirror.active = true }
|
||||
it 'shoud be active' do
|
||||
expect(@mirror.active).to be true
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when active is false' do
|
||||
before { @mirror.active = false }
|
||||
it 'should be inactive' do
|
||||
expect(@mirror.active).to be false
|
||||
end
|
||||
end
|
||||
|
||||
context 'it should accept different refspec format' do
|
||||
it 'should accept <name>' do
|
||||
expect_valid_refspec 'devel'
|
||||
end
|
||||
|
||||
it 'should accept a branch path' do
|
||||
expect_valid_refspec 'refs/branches/dev'
|
||||
end
|
||||
|
||||
it 'should accept the update param (+)' do
|
||||
expect_valid_refspec '+refs/branches/dev'
|
||||
end
|
||||
|
||||
it 'should accept the wildcard param (*)' do
|
||||
expect_valid_refspec '+refs/branches/*'
|
||||
end
|
||||
|
||||
it 'should accept a destination' do
|
||||
expect_valid_refspec '+refs/branches/*:refs/branches/*'
|
||||
expect_valid_refspec '+refs/heads/experiment:refs/remotes/origin/experiment'
|
||||
expect_valid_refspec '+devel:devel'
|
||||
expect_valid_refspec '+devel:devel/*'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
describe 'Invalid Mirror creation' do
|
||||
## Test presence conflicts
|
||||
it 'is invalid when include_all_branches && include_all_tags' do
|
||||
expect(build_mirror(push_mode: 1, include_all_branches: true, include_all_tags: true)).not_to be_valid
|
||||
end
|
||||
|
||||
it 'is invalid when include_all_branches && explicit_refspec' do
|
||||
expect(build_mirror(push_mode: 1, include_all_branches: true, explicit_refspec: 'devel')).not_to be_valid
|
||||
end
|
||||
|
||||
## Validate push mode : forced
|
||||
it 'is invalid when push_mode forced without params' do
|
||||
expect(build_mirror(push_mode: 1)).not_to be_valid
|
||||
end
|
||||
|
||||
## Validate push mode : fast_forward
|
||||
it 'is invalid when push_mode fast_forward without params' do
|
||||
expect(build_mirror(push_mode: 2)).not_to be_valid
|
||||
end
|
||||
|
||||
## Validate explicit_refspec
|
||||
it 'should check that <source> and <target> are well formated' do
|
||||
expect_invalid_refspec ':'
|
||||
expect_invalid_refspec ':devel'
|
||||
expect_invalid_refspec ':/devel'
|
||||
expect_invalid_refspec '/devel:/devel'
|
||||
expect_invalid_refspec 'devel:/devel'
|
||||
expect_invalid_refspec '/devel:devel'
|
||||
expect_invalid_refspec '/devel:devel/*'
|
||||
expect_invalid_refspec '+refs/branches*:refs/branches*'
|
||||
expect_invalid_refspec '+refs/branches*:refs/branches/*'
|
||||
expect_invalid_refspec '+refs/branches/*:refs/branches'
|
||||
expect_invalid_refspec '+refs/branches/*:refs/branches/'
|
||||
expect_invalid_refspec '+refs/branches:refs/branches/*'
|
||||
expect_invalid_refspec '+refs/branches/:refs/branches/*'
|
||||
expect_invalid_refspec '+refs/branches/v[0-9]:refs/branches/v[0-9]'
|
||||
expect_invalid_refspec '+refs/branches/v[0-9]/refs/branches/v[0-9]'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context 'when many mirror are saved' do
|
||||
before do
|
||||
create(:repository_mirror, active: true)
|
||||
create(:repository_mirror, active: true)
|
||||
create(:repository_mirror, active: false)
|
||||
create(:repository_mirror, active: false)
|
||||
end
|
||||
|
||||
it { expect(RepositoryMirror.active.length).to be == 3 }
|
||||
it { expect(RepositoryMirror.inactive.length).to be == 2 }
|
||||
end
|
||||
|
||||
end
|
|
@ -1,51 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
describe RepositoryPostReceiveUrl do
|
||||
|
||||
let(:post_receive_url) { build(:repository_post_receive_url) }
|
||||
|
||||
subject { post_receive_url }
|
||||
|
||||
## Relations
|
||||
it { should belong_to(:repository) }
|
||||
|
||||
## Validations
|
||||
it { should be_valid }
|
||||
|
||||
it { should validate_presence_of(:repository_id) }
|
||||
it { should validate_presence_of(:url) }
|
||||
it { should validate_presence_of(:mode) }
|
||||
|
||||
it { should validate_uniqueness_of(:url).scoped_to(:repository_id) }
|
||||
|
||||
it { should validate_inclusion_of(:mode).in_array([:github, :get]) }
|
||||
|
||||
it { should allow_value('http://foo.com', 'https://bar.com/baz').for(:url) }
|
||||
|
||||
## Serializations
|
||||
# it { should serialize(:triggers) }
|
||||
|
||||
## Attributes content
|
||||
it { expect(post_receive_url.active).to be true }
|
||||
it { expect(post_receive_url.mode).to eq :github }
|
||||
it { expect(post_receive_url.use_triggers).to be false }
|
||||
it { expect(post_receive_url.triggers).to be_a(Array) }
|
||||
it { expect(post_receive_url.split_payloads).to be false }
|
||||
|
||||
|
||||
# describe '.active' do
|
||||
# it 'should return an array of active post_receive_urls' do
|
||||
# expect(RepositoryPostReceiveUrl).to receive(:where).with(active: true)
|
||||
# RepositoryPostReceiveUrl.active
|
||||
# end
|
||||
# end
|
||||
|
||||
|
||||
# describe '.inactive' do
|
||||
# it 'should return an array of inactive post_receive_urls' do
|
||||
# expect(RepositoryPostReceiveUrl).to receive(:where).with(active: false)
|
||||
# RepositoryPostReceiveUrl.inactive
|
||||
# end
|
||||
# end
|
||||
|
||||
end
|
|
@ -1,52 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
describe RepositoryProtectedBranche do
|
||||
|
||||
let(:protected_branch) { build(:repository_protected_branche) }
|
||||
|
||||
subject { protected_branch }
|
||||
|
||||
## Relations
|
||||
it { should belong_to(:repository) }
|
||||
it { should have_many(:protected_branches_members).with_foreign_key(:protected_branch_id).dependent(:destroy) }
|
||||
it { should have_many(:members).through(:protected_branches_members) }
|
||||
|
||||
## Validations
|
||||
it { should be_valid }
|
||||
|
||||
it { should validate_presence_of(:repository_id) }
|
||||
it { should validate_presence_of(:path) }
|
||||
it { should validate_presence_of(:permissions) }
|
||||
|
||||
it { should validate_uniqueness_of(:path).scoped_to([:permissions, :repository_id]) }
|
||||
|
||||
it { should validate_inclusion_of(:permissions).in_array RepositoryProtectedBranche::VALID_PERMS }
|
||||
|
||||
describe '#users' do
|
||||
it 'should return an array of users' do
|
||||
user = build(:user)
|
||||
group = build(:group)
|
||||
expect(protected_branch).to receive(:members).and_return([user, user, group])
|
||||
expect(protected_branch.users).to eq [user]
|
||||
end
|
||||
end
|
||||
|
||||
describe '#groups' do
|
||||
it 'should return an array of groups' do
|
||||
user = build(:user)
|
||||
group = build(:group)
|
||||
expect(protected_branch).to receive(:members).and_return([group, user, group])
|
||||
expect(protected_branch.groups).to eq [group]
|
||||
end
|
||||
end
|
||||
|
||||
describe '#allowed_users' do
|
||||
it 'should return an array of gitolite identifiers' do
|
||||
user1 = build(:user)
|
||||
user2 = build(:user)
|
||||
expect(protected_branch).to receive(:users).and_return([user1, user2])
|
||||
expect(protected_branch.allowed_users).to eq [user1.gitolite_identifier, user2.gitolite_identifier]
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -1,301 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
describe Repository::Xitolite do
|
||||
|
||||
GIT_USER = 'git'
|
||||
|
||||
before(:all) do
|
||||
Setting.plugin_redmine_git_hosting[:gitolite_redmine_storage_dir] = 'redmine/'
|
||||
Setting.plugin_redmine_git_hosting[:http_server_subdir] = 'git/'
|
||||
User.current = nil
|
||||
|
||||
@project_parent = FactoryBot.create(:project, identifier: 'project-parent')
|
||||
@project_child = FactoryBot.create(:project, identifier: 'project-child', parent_id: @project_parent.id, is_public: false)
|
||||
end
|
||||
|
||||
|
||||
describe 'common_tests : fast tests' do
|
||||
before(:each) do
|
||||
Setting.plugin_redmine_git_hosting[:hierarchical_organisation] = 'true'
|
||||
Setting.plugin_redmine_git_hosting[:unique_repo_identifier] = 'false'
|
||||
|
||||
@repository_1 = build_git_repository(project: @project_child, is_default: true)
|
||||
@repository_1.valid?
|
||||
@repository_1.build_extra(default_branch: 'master', key: RedmineGitHosting::Utils::Crypto.generate_secret(64), git_https: true)
|
||||
end
|
||||
|
||||
subject { @repository_1 }
|
||||
|
||||
it { should be_valid }
|
||||
|
||||
## Relations
|
||||
it { should have_many(:mirrors) }
|
||||
it { should have_many(:post_receive_urls) }
|
||||
it { should have_many(:deployment_credentials) }
|
||||
it { should have_many(:git_config_keys) }
|
||||
it { should have_many(:protected_branches) }
|
||||
|
||||
it { should have_one(:extra) }
|
||||
|
||||
## Attributes
|
||||
it { expect(@repository_1.report_last_commit).to be true }
|
||||
it { expect(@repository_1.extra_report_last_commit).to be true }
|
||||
it { expect(@repository_1.git_default_branch).to eq 'master' }
|
||||
it { expect(@repository_1.gitolite_hook_key).to match /\A[a-zA-Z0-9]+\z/ }
|
||||
it { expect(@repository_1.git_daemon_enabled?).to be true }
|
||||
it { expect(@repository_1.git_annex_enabled?).to be false }
|
||||
it { expect(@repository_1.git_notification_enabled?).to be true }
|
||||
it { expect(@repository_1.smart_http_enabled?).to be true }
|
||||
it { expect(@repository_1.https_access_enabled?).to be true }
|
||||
it { expect(@repository_1.http_access_enabled?).to be false }
|
||||
it { expect(@repository_1.only_https_access_enabled?).to be true }
|
||||
it { expect(@repository_1.only_http_access_enabled?).to be false }
|
||||
it { expect(@repository_1.protected_branches_enabled?).to be false }
|
||||
it { expect(@repository_1.public_project?).to be false }
|
||||
it { expect(@repository_1.public_repo?).to be false }
|
||||
it { expect(@repository_1.urls_order).to eq [] }
|
||||
|
||||
|
||||
it 'should not allow identifier gitolite-admin' do
|
||||
expect(build_git_repository(project: @project_parent, identifier: 'gitolite-admin')).to be_invalid
|
||||
end
|
||||
|
||||
|
||||
describe '#exists_in_gitolite?' do
|
||||
it 'should check if repository exists on Gitolite side' do
|
||||
expect(RedmineGitHosting::Commands).to receive(:sudo_dir_exists?).with('repositories/redmine/project-parent/project-child.git')
|
||||
@repository_1.exists_in_gitolite?
|
||||
end
|
||||
end
|
||||
|
||||
describe '#empty_in_gitolite?' do
|
||||
it 'should check if repository is empty on Gitolite side' do
|
||||
expect(RedmineGitHosting::Commands).to receive(:sudo_repository_empty?).with('repositories/redmine/project-parent/project-child.git')
|
||||
@repository_1.empty_in_gitolite?
|
||||
end
|
||||
end
|
||||
|
||||
describe '#git_objects_count' do
|
||||
it 'should return repository objects count' do
|
||||
expect(RedmineGitHosting::Commands).to receive(:sudo_git_objects_count).with('repositories/redmine/project-parent/project-child.git/objects')
|
||||
@repository_1.git_objects_count
|
||||
end
|
||||
end
|
||||
|
||||
describe '#data_for_destruction' do
|
||||
it 'should return a hash of data' do
|
||||
expect(@repository_1.data_for_destruction).to eq({
|
||||
delete_repository: true,
|
||||
git_cache_id: 'project-child',
|
||||
repo_name: 'redmine/project-parent/project-child',
|
||||
repo_path: '/home/git/repositories/redmine/project-parent/project-child.git',
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
describe '#empty?' do
|
||||
it 'should check if repository is empty from Redmine point of view' do
|
||||
expect(@repository_1.empty?).to be true
|
||||
end
|
||||
end
|
||||
|
||||
describe '#empty_cache!' do
|
||||
it 'should flush the repository git cache' do
|
||||
expect(RedmineGitHosting::Cache).to receive(:clear_cache_for_repository).with('project-child')
|
||||
@repository_1.empty_cache!
|
||||
end
|
||||
end
|
||||
|
||||
describe '#available_urls' do
|
||||
context 'with no option' do
|
||||
my_hash = {}
|
||||
|
||||
it 'should return an empty Hash' do
|
||||
@repository_1.extra[:git_daemon] = false
|
||||
@repository_1.extra[:git_http] = false
|
||||
@repository_1.extra[:git_https] = false
|
||||
@repository_1.extra[:git_go] = false
|
||||
@repository_1.extra[:git_ssh] = false
|
||||
expect(@repository_1.available_urls).to eq my_hash
|
||||
end
|
||||
end
|
||||
|
||||
context 'with all options' do
|
||||
my_hash = {
|
||||
ssh: { url: "ssh://#{GIT_USER}@localhost/redmine/project-parent/project-child.git", committer: 'true' },
|
||||
https: { url: 'https://redmine-test-user@localhost/git/project-parent/project-child.git', committer: 'true' },
|
||||
http: { url: 'http://redmine-test-user@localhost/git/project-parent/project-child.git', committer: 'false' },
|
||||
go: { url: 'localhost/go/project-parent/project-child', committer: 'false' },
|
||||
git: { url: 'git://localhost/redmine/project-parent/project-child.git', committer: 'false' }
|
||||
}
|
||||
|
||||
it 'should return a Hash of Git url' do
|
||||
@user = create_user_with_permissions(@project_child, login: 'redmine-test-user')
|
||||
User.current = @user
|
||||
@project_child.is_public = true
|
||||
@repository_1.extra[:git_daemon] = true
|
||||
@repository_1.extra[:git_http] = true
|
||||
@repository_1.extra[:git_https] = true
|
||||
@repository_1.extra[:git_go] = true
|
||||
@repository_1.extra[:git_ssh] = true
|
||||
@repository_1.extra.save
|
||||
expect(@repository_1.available_urls).to eq my_hash
|
||||
end
|
||||
end
|
||||
|
||||
context 'with git daemon' do
|
||||
my_hash = { git: { url: 'git://localhost/redmine/project-parent/project-child.git', committer: 'false' } }
|
||||
|
||||
it 'should return a Hash of Git url' do
|
||||
User.current = nil
|
||||
@project_child.is_public = true
|
||||
@repository_1.extra[:git_daemon] = true
|
||||
@repository_1.extra[:git_http] = false
|
||||
@repository_1.extra[:git_https] = false
|
||||
@repository_1.extra[:git_go] = false
|
||||
@repository_1.extra[:git_ssh] = false
|
||||
@repository_1.extra.save
|
||||
expect(@repository_1.available_urls).to eq my_hash
|
||||
end
|
||||
end
|
||||
|
||||
context 'with ssh' do
|
||||
my_hash = { ssh: { url: "ssh://#{GIT_USER}@localhost/redmine/project-parent/project-child.git", committer: 'true' } }
|
||||
|
||||
it 'should return a Hash of Git url' do
|
||||
@user = create_user_with_permissions(@project_child, login: 'redmine-test-user')
|
||||
User.current = @user
|
||||
@repository_1.extra[:git_daemon] = false
|
||||
@repository_1.extra[:git_http] = false
|
||||
@repository_1.extra[:git_https] = false
|
||||
@repository_1.extra[:git_go] = false
|
||||
@repository_1.extra[:git_ssh] = true
|
||||
@repository_1.extra.save
|
||||
expect(@repository_1.available_urls).to eq my_hash
|
||||
end
|
||||
end
|
||||
|
||||
context 'with http' do
|
||||
my_hash = { http: { url: 'http://localhost/git/project-parent/project-child.git', committer: 'false' } }
|
||||
|
||||
it 'should return a Hash of Git url' do
|
||||
User.current = nil
|
||||
@project_child.is_public = false
|
||||
@repository_1.extra[:git_daemon] = false
|
||||
@repository_1.extra[:git_http] = true
|
||||
@repository_1.extra[:git_https] = false
|
||||
@repository_1.extra[:git_go] = false
|
||||
@repository_1.extra[:git_ssh] = false
|
||||
@repository_1.extra.save
|
||||
expect(@repository_1.available_urls).to eq my_hash
|
||||
end
|
||||
end
|
||||
|
||||
context 'with https' do
|
||||
my_hash = { https: { url: 'https://localhost/git/project-parent/project-child.git', committer: 'false' } }
|
||||
|
||||
it 'should return a Hash of Git url' do
|
||||
User.current = nil
|
||||
@project_child.is_public = false
|
||||
@repository_1.extra[:git_daemon] = false
|
||||
@repository_1.extra[:git_http] = false
|
||||
@repository_1.extra[:git_https] = true
|
||||
@repository_1.extra[:git_go] = false
|
||||
@repository_1.extra[:git_ssh] = false
|
||||
@repository_1.extra.save
|
||||
expect(@repository_1.available_urls).to eq my_hash
|
||||
end
|
||||
end
|
||||
|
||||
context 'with http and https' do
|
||||
my_hash = {
|
||||
https: { url: 'https://localhost/git/project-parent/project-child.git', committer: 'false' },
|
||||
http: { url: 'http://localhost/git/project-parent/project-child.git', committer: 'false' }
|
||||
}
|
||||
|
||||
it 'should return a Hash of Git url' do
|
||||
User.current = nil
|
||||
@project_child.is_public = false
|
||||
@repository_1.extra[:git_daemon] = false
|
||||
@repository_1.extra[:git_http] = true
|
||||
@repository_1.extra[:git_https] = true
|
||||
@repository_1.extra[:git_go] = false
|
||||
@repository_1.extra[:git_ssh] = false
|
||||
@repository_1.extra.save
|
||||
expect(@repository_1.available_urls).to eq my_hash
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe 'Repository::Xitolite class' do
|
||||
it { expect(Repository::Xitolite).to respond_to(:repo_ident_unique?) }
|
||||
it { expect(Repository::Xitolite).to respond_to(:have_duplicated_identifier?) }
|
||||
it { expect(Repository::Xitolite).to respond_to(:repo_path_to_git_cache_id) }
|
||||
it { expect(Repository::Xitolite).to respond_to(:find_by_path) }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe 'common_tests : long tests' do
|
||||
before do
|
||||
Setting.plugin_redmine_git_hosting[:hierarchical_organisation] = 'true'
|
||||
Setting.plugin_redmine_git_hosting[:unique_repo_identifier] = 'false'
|
||||
|
||||
@repository_1 = create_git_repository(project: @project_child, is_default: true)
|
||||
extra = @repository_1.build_extra(default_branch: 'master', key: RedmineGitHosting::Utils::Crypto.generate_secret(64))
|
||||
extra.save!
|
||||
|
||||
@repository_2 = create_git_repository(project: @project_child, identifier: 'repo-test')
|
||||
end
|
||||
|
||||
context 'when blank identifier' do
|
||||
it 'should not allow identifier changes' do
|
||||
@repository_1.identifier = 'new_repo'
|
||||
expect(@repository_1).to be_invalid
|
||||
expect(@repository_1.identifier).to eq 'new_repo'
|
||||
end
|
||||
end
|
||||
|
||||
context 'when non blank identifier' do
|
||||
it 'should not allow identifier changes' do
|
||||
@repository_2.identifier = 'new_repo2'
|
||||
expect(@repository_2).to be_valid
|
||||
expect(@repository_2.identifier).to eq 'repo-test'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe 'Test uniqueness' do
|
||||
context 'when blank identifier is already taken by a repository' do
|
||||
it { expect(build_git_repository(project: @project_child, identifier: '')).to be_invalid }
|
||||
end
|
||||
|
||||
context 'when set as default and blank identifier is already taken by a repository' do
|
||||
it { expect(build_git_repository(project: @project_child, identifier: '', is_default: true)).to be_invalid }
|
||||
end
|
||||
|
||||
context 'when identifier is already taken by a project' do
|
||||
it { expect(build_git_repository(project: @project_child, identifier: 'project-child')).to be_invalid }
|
||||
end
|
||||
|
||||
context 'when identifier is already taken by a repository with same project' do
|
||||
it { expect(build_git_repository(project: @project_child, identifier: 'repo-test')).to be_invalid }
|
||||
end
|
||||
|
||||
context 'when identifier are not unique' do
|
||||
it { expect(build_git_repository(project: @project_parent, identifier: 'repo-test')).to be_valid }
|
||||
end
|
||||
|
||||
context 'when identifier are unique' do
|
||||
it 'should refuse duplicated identifier' do
|
||||
Setting.plugin_redmine_git_hosting[:unique_repo_identifier] = 'true'
|
||||
expect(build_git_repository(project: @project_parent, identifier: 'repo-test')).to be_invalid
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
include_context 'flat_organisation'
|
||||
include_context 'hierarchical_organisation'
|
||||
end
|
|
@ -1,15 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
describe Setting do
|
||||
before do
|
||||
RedmineGitHosting::Config.reload_from_file!
|
||||
@settings = Setting.plugin_redmine_git_hosting
|
||||
@default_settings = Redmine::Plugin.find('redmine_git_hosting').settings[:default]
|
||||
end
|
||||
|
||||
subject { @settings }
|
||||
|
||||
it { should be_an_instance_of(Hash) }
|
||||
|
||||
# it { expect(@settings).to eq @default_settings }
|
||||
end
|
|
@ -1,15 +0,0 @@
|
|||
require File.expand_path('../spec_helper', __dir__)
|
||||
|
||||
describe User do
|
||||
let(:user) { build(:user) }
|
||||
|
||||
it { is_expected.to have_many(:protected_branches_members).dependent(:destroy) }
|
||||
it { is_expected.to have_many(:protected_branches).through(:protected_branches_members) }
|
||||
|
||||
describe '#gitolite_identifier' do
|
||||
it 'return the gitolite_identifier' do
|
||||
user = build(:user, login: 'adam.30', id: 12)
|
||||
expect(user.gitolite_identifier).to eq 'redmine_adam_30_12'
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,51 +0,0 @@
|
|||
unless ENV['DISABLE_COVERAGE'] == 'true'
|
||||
require 'simplecov'
|
||||
|
||||
## Start Simplecov
|
||||
SimpleCov.start 'rails' do
|
||||
add_group 'Redmine Git Hosting', 'plugins/redmine_git_hosting'
|
||||
end
|
||||
end
|
||||
|
||||
## Load Redmine App
|
||||
ENV['RAILS_ENV'] = 'test'
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../config/environment')
|
||||
require 'rspec/rails'
|
||||
|
||||
## Load FactoryBots factories
|
||||
Dir[Rails.root.join('plugins/*/spec/factories/**/*.rb')].each { |f| require f }
|
||||
|
||||
Dir[Rails.root.join('plugins/*/spec/support/**/*.rb')].each { |f| require f }
|
||||
|
||||
## Configure RSpec
|
||||
RSpec.configure do |config|
|
||||
config.include FactoryBot::Syntax::Methods
|
||||
|
||||
config.infer_spec_type_from_file_location!
|
||||
|
||||
config.color = true
|
||||
config.fail_fast = false
|
||||
|
||||
config.expect_with :rspec do |c|
|
||||
c.syntax = :expect
|
||||
end
|
||||
|
||||
config.before(:suite) do
|
||||
DatabaseCleaner.clean_with(:truncation)
|
||||
end
|
||||
|
||||
config.before(:each) do
|
||||
DatabaseCleaner.strategy = :transaction
|
||||
end
|
||||
|
||||
config.before(:each) do
|
||||
DatabaseCleaner.start
|
||||
end
|
||||
|
||||
config.after(:each) do
|
||||
DatabaseCleaner.clean
|
||||
end
|
||||
end
|
||||
|
||||
# Disable Test::Unit automatic runner
|
||||
Test::Unit::AutoRunner.need_auto_run = false if defined?(Test::Unit::AutoRunner)
|
|
@ -1,56 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
||||
|
||||
describe RedmineHooks::CallWebservices do
|
||||
|
||||
let(:global_payload) { load_yaml_fixture('global_payload.yml') }
|
||||
let(:master_payload) { load_yaml_fixture('master_payload.yml') }
|
||||
let(:branches_payload) { load_yaml_fixture('branches_payload.yml') }
|
||||
|
||||
|
||||
def build_web_hook(payload, opts = {})
|
||||
post_receive_url = build(:repository_post_receive_url, opts)
|
||||
RedmineHooks::CallWebservices.new(post_receive_url, payload)
|
||||
end
|
||||
|
||||
|
||||
describe '#needs_push' do
|
||||
context 'when payload is empty' do
|
||||
it 'shoud return false' do
|
||||
web_hook = build_web_hook([])
|
||||
expect(web_hook.needs_push?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
context 'when triggers are not used' do
|
||||
it 'should return the global payload to push' do
|
||||
web_hook = build_web_hook(global_payload)
|
||||
expect(web_hook.needs_push?).to be true
|
||||
expect(web_hook.payloads_to_send).to eq global_payload
|
||||
end
|
||||
end
|
||||
|
||||
context 'when triggers are empty' do
|
||||
it 'should return the global payload to push' do
|
||||
web_hook = build_web_hook(global_payload, use_triggers: true)
|
||||
expect(web_hook.needs_push?).to be false
|
||||
expect(web_hook.payloads_to_send).to eq []
|
||||
end
|
||||
end
|
||||
|
||||
context 'when triggers is set to master' do
|
||||
it 'should return the master payload' do
|
||||
web_hook = build_web_hook(global_payload, use_triggers: true, triggers: ['master'])
|
||||
expect(web_hook.needs_push?).to be true
|
||||
expect(web_hook.payloads_to_send).to eq master_payload
|
||||
end
|
||||
end
|
||||
|
||||
context 'when triggers is set to master' do
|
||||
it 'should not be found in branches payload and return false' do
|
||||
web_hook = build_web_hook(branches_payload, use_triggers: true, triggers: ['master'])
|
||||
expect(web_hook.needs_push?).to be false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -1,14 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../../../spec/spec_helper')
|
||||
|
||||
## Configure RSpec
|
||||
RSpec.configure do |config|
|
||||
|
||||
# Include our helpers from support directory
|
||||
config.include GlobalHelpers
|
||||
|
||||
config.before(:suite) do
|
||||
RedmineGitHosting::Config.reload_from_file!
|
||||
Setting.enabled_scm = ['Git', 'Subversion', 'Xitolite']
|
||||
end
|
||||
|
||||
end
|
|
@ -1,217 +0,0 @@
|
|||
module CrudControllerSpec
|
||||
module Base
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
include CrudControllerSpec::Helpers
|
||||
|
||||
before(:all) do
|
||||
@project = create_project('git_project')
|
||||
@repository = find_or_create_git_repository(project: @project, identifier: 'git_repository')
|
||||
@repository2 = find_or_create_git_repository(project: @project, identifier: 'git_repository2')
|
||||
@member_user = create_user_with_permissions(@project, member_user_options)
|
||||
@anonymous_user = create_anonymous_user
|
||||
@object = create_object
|
||||
end
|
||||
|
||||
describe 'GET #index' do
|
||||
context 'with sufficient permissions' do
|
||||
before(:each) { set_session_user(@member_user) }
|
||||
|
||||
it 'renders the :index view' do
|
||||
check_index_template
|
||||
end
|
||||
end
|
||||
|
||||
context 'with unsufficient permissions' do
|
||||
it 'renders 403' do
|
||||
set_session_user(@anonymous_user)
|
||||
check_index_status(403)
|
||||
end
|
||||
end
|
||||
end unless respond_to?(:skip_actions) && skip_actions.include?('index')
|
||||
|
||||
describe 'GET #show' do
|
||||
before { Setting.rest_api_enabled = 1 }
|
||||
|
||||
context 'with sufficient permissions' do
|
||||
it 'renders 200' do
|
||||
check_api_response(200, id: @object.id, key: @member_user.api_key)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with unsufficient permissions' do
|
||||
it 'renders 403' do
|
||||
check_api_response(403, id: @object.id, key: @anonymous_user.api_key)
|
||||
end
|
||||
end
|
||||
end unless respond_to?(:skip_actions) && skip_actions.include?('show')
|
||||
|
||||
describe 'GET #new' do
|
||||
context 'with sufficient permissions' do
|
||||
before(:each) { set_session_user(@member_user) }
|
||||
|
||||
it 'assigns a new @object variable' do
|
||||
check_new_variable(main_variable, tested_klass)
|
||||
end
|
||||
|
||||
it 'renders the :new template' do
|
||||
check_new_template
|
||||
end
|
||||
end
|
||||
|
||||
context 'with unsufficient permissions' do
|
||||
it 'renders 403' do
|
||||
set_session_user(@anonymous_user)
|
||||
check_new_status(403)
|
||||
end
|
||||
end
|
||||
end unless respond_to?(:skip_actions) && skip_actions.include?('new')
|
||||
|
||||
describe 'POST #create' do
|
||||
context 'with sufficient permissions' do
|
||||
before(:each) do
|
||||
set_session_user(@member_user)
|
||||
allow(controller).to receive(:call_use_case)
|
||||
end
|
||||
|
||||
context 'with valid attributes' do
|
||||
it 'saves the new object in the database' do
|
||||
check_counter_incremented_on_create(tested_klass, valid_params_for_create)
|
||||
end
|
||||
|
||||
it 'redirects to the repository page' do
|
||||
check_create_status(200, valid_params_for_create)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with invalid attributes' do
|
||||
it 'does not save the new object in the database' do
|
||||
check_counter_not_changed_on_create(tested_klass, invalid_params_for_create)
|
||||
end
|
||||
|
||||
it 're-renders the :new template' do
|
||||
check_create_template(:create, invalid_params_for_create)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with unsufficient permissions' do
|
||||
it 'renders 403' do
|
||||
set_session_user(@anonymous_user)
|
||||
check_create_status(403, valid_params_for_create)
|
||||
end
|
||||
end
|
||||
end unless respond_to?(:skip_actions) && skip_actions.include?('create')
|
||||
|
||||
describe 'GET #edit' do
|
||||
context 'with sufficient permissions' do
|
||||
before(:each) { set_session_user(@member_user) }
|
||||
|
||||
context 'with existing object' do
|
||||
it 'assigns the requested object to @object' do
|
||||
check_edit_variable(main_variable, @object, id: @object.id)
|
||||
end
|
||||
|
||||
it 'renders the :edit template' do
|
||||
check_edit_template(id: @object.id)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with non-existing object' do
|
||||
it 'renders 404' do
|
||||
check_edit_status(404, id: 100)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with non-matching repository' do
|
||||
it 'renders 404' do
|
||||
check_edit_status(404, repository_id: @repository2.id, id: @object.id)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with non-existing repository' do
|
||||
it 'renders 404' do
|
||||
check_edit_status(404, repository_id: 345, id: @object.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with unsufficient permissions' do
|
||||
it 'renders 403' do
|
||||
set_session_user(@anonymous_user)
|
||||
check_edit_status(403, id: @object.id)
|
||||
end
|
||||
end
|
||||
end unless respond_to?(:skip_actions) && skip_actions.include?('edit')
|
||||
|
||||
describe 'PUT #update' do
|
||||
context 'with sufficient permissions' do
|
||||
before(:each) do
|
||||
set_session_user(@member_user)
|
||||
allow(controller).to receive(:call_use_case)
|
||||
end
|
||||
|
||||
context 'with valid attributes' do
|
||||
it 'located the requested @object' do
|
||||
check_update_variable(main_variable, @object, valid_params_for_update)
|
||||
end
|
||||
|
||||
it 'changes @object attributes' do
|
||||
check_attribute_has_changed(updated_attribute, updated_attribute_value, valid_params_for_update)
|
||||
end
|
||||
|
||||
it 'redirects to the repository page' do
|
||||
check_update_status(200, valid_params_for_update)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with invalid attributes' do
|
||||
it 'located the requested @object' do
|
||||
check_update_variable(main_variable, @object, invalid_params_for_update)
|
||||
end
|
||||
|
||||
it 'does not change @object attributes' do
|
||||
check_attribute_has_not_changed(updated_attribute, invalid_params_for_update)
|
||||
end
|
||||
|
||||
it 're-renders the :edit template' do
|
||||
check_update_template(invalid_params_for_update)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with unsufficient permissions' do
|
||||
it 'renders 403' do
|
||||
set_session_user(@anonymous_user)
|
||||
check_update_status(403, valid_params_for_update)
|
||||
end
|
||||
end
|
||||
end unless respond_to?(:skip_actions) && skip_actions.include?('update')
|
||||
|
||||
describe 'DELETE #destroy' do
|
||||
context 'with sufficient permissions' do
|
||||
before(:each) do
|
||||
set_session_user(@member_user)
|
||||
allow(controller).to receive(:call_use_case)
|
||||
end
|
||||
|
||||
it 'deletes the object' do
|
||||
check_counter_decremented_on_delete(tested_klass, id: create_object.id)
|
||||
end
|
||||
|
||||
it 'redirects to repositories#edit' do
|
||||
check_delete_status(200, id: create_object.id)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with unsufficient permissions' do
|
||||
it 'renders 403' do
|
||||
set_session_user(@anonymous_user)
|
||||
check_delete_status(403, id: create_object.id)
|
||||
end
|
||||
end
|
||||
end unless respond_to?(:skip_actions) && skip_actions.include?('destroy')
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,143 +0,0 @@
|
|||
module CrudControllerSpec
|
||||
module Helpers
|
||||
##### INDEX
|
||||
def check_index_template
|
||||
get :index, params: base_options
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
def check_index_status(status)
|
||||
get :index, params: base_options
|
||||
check_status(status)
|
||||
end
|
||||
|
||||
##### SHOW
|
||||
|
||||
def check_api_response(status, opts = {})
|
||||
get :show, params: merge_options(opts).merge(format: 'json')
|
||||
check_status(status)
|
||||
end
|
||||
|
||||
##### NEW
|
||||
|
||||
def check_new_variable(variable, klass)
|
||||
get :new, params: base_options
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
def check_new_template
|
||||
get :new, params: base_options
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
def check_new_status(status)
|
||||
get :new, params: base_options
|
||||
check_status(status)
|
||||
end
|
||||
|
||||
##### CREATE
|
||||
|
||||
def check_create_template(template, opts = {})
|
||||
xhr_post merge_options(opts)
|
||||
end
|
||||
|
||||
def check_create_status(status, opts = {})
|
||||
xhr_post merge_options(opts)
|
||||
check_status(status)
|
||||
end
|
||||
|
||||
def check_counter_incremented_on_create(klass, opts = {})
|
||||
expect { xhr_post merge_options(opts) }.to change(klass, :count).by(1)
|
||||
end
|
||||
|
||||
def check_counter_not_changed_on_create(klass, opts = {})
|
||||
expect { xhr_post merge_options(opts) }.not_to change(klass, :count)
|
||||
end
|
||||
|
||||
##### EDIT
|
||||
|
||||
def check_edit_variable(variable, value, opts = {})
|
||||
get :edit, params: merge_options(opts)
|
||||
end
|
||||
|
||||
def check_edit_template(opts = {})
|
||||
get :edit, params: merge_options(opts)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
def check_edit_status(status, opts = {})
|
||||
get :edit, params: merge_options(opts)
|
||||
check_status(status)
|
||||
end
|
||||
|
||||
##### UPDATE
|
||||
|
||||
def check_update_variable(variable, value, opts = {})
|
||||
xhr_put merge_options(opts)
|
||||
@object.reload
|
||||
end
|
||||
|
||||
def check_attribute_has_changed(method, value, opts = {})
|
||||
xhr_put merge_options(opts)
|
||||
@object.reload
|
||||
check_equality(@object.send(method), value)
|
||||
end
|
||||
|
||||
def check_attribute_has_not_changed(method, opts = {})
|
||||
old_value = @object.send(method)
|
||||
xhr_put merge_options(opts)
|
||||
@object.reload
|
||||
check_equality(@object.send(method), old_value)
|
||||
end
|
||||
|
||||
def check_update_template(opts = {})
|
||||
xhr_put merge_options(opts)
|
||||
end
|
||||
|
||||
def check_update_status(status, opts = {})
|
||||
xhr_put merge_options(opts)
|
||||
check_status(status)
|
||||
end
|
||||
|
||||
##### DELETE
|
||||
|
||||
def check_counter_decremented_on_delete(klass, opts = {})
|
||||
expect { delete :destroy, params: merge_options(opts).merge(format: 'js') }.to change(klass, :count).by(-1)
|
||||
end
|
||||
|
||||
def check_delete_status(status, opts = {})
|
||||
delete :destroy, params: merge_options(opts).merge(format: 'js')
|
||||
check_status(status)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def base_options
|
||||
{ repository_id: @repository.id }.clone
|
||||
end
|
||||
|
||||
def merge_options(opts = {})
|
||||
base_options.merge(opts)
|
||||
end
|
||||
|
||||
def member_user_options
|
||||
{ permissions: permissions }
|
||||
end
|
||||
|
||||
def check_status(status)
|
||||
expect(response.status).to eq status
|
||||
end
|
||||
|
||||
def check_equality(variable, value)
|
||||
expect(variable).to eq value
|
||||
end
|
||||
|
||||
def xhr_post(opts = {})
|
||||
post :create, params: opts, xhr: true
|
||||
end
|
||||
|
||||
def xhr_put(opts = {})
|
||||
put :update, params: opts, xhr: true
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,190 +0,0 @@
|
|||
RSpec.shared_context 'flat_organisation' do
|
||||
|
||||
##################################################
|
||||
# #
|
||||
# FLAT ORGANISATION / UNIQUE REPOSITORIES TESTS #
|
||||
# #
|
||||
##################################################
|
||||
|
||||
UNIQUE_REPOSITORIES_MATRIX = {
|
||||
repository_1: {
|
||||
is_default: true,
|
||||
identifier: '',
|
||||
url: 'repositories/redmine/project-child.git',
|
||||
root_url: 'repositories/redmine/project-child.git',
|
||||
git_cache_id: 'project-child',
|
||||
redmine_name: 'project-child',
|
||||
gitolite_repository_path: 'repositories/redmine/project-child.git',
|
||||
gitolite_full_repository_path: '/home/git/repositories/redmine/project-child.git',
|
||||
gitolite_repository_name: 'redmine/project-child',
|
||||
redmine_repository_path: 'project-child',
|
||||
new_repository_name: 'redmine/project-child',
|
||||
old_repository_name: 'redmine/project-child',
|
||||
http_user_login: '',
|
||||
git_access_path: 'redmine/project-child.git',
|
||||
http_access_path: 'git/project-child.git',
|
||||
ssh_url: "ssh://#{GIT_USER}@localhost/redmine/project-child.git",
|
||||
git_url: 'git://localhost/redmine/project-child.git',
|
||||
http_url: 'http://localhost/git/project-child.git',
|
||||
https_url: 'https://localhost/git/project-child.git',
|
||||
},
|
||||
|
||||
repository_2: {
|
||||
is_default: false,
|
||||
identifier: 'repo1-test',
|
||||
url: 'repositories/redmine/repo1-test.git',
|
||||
root_url: 'repositories/redmine/repo1-test.git',
|
||||
git_cache_id: 'repo1-test',
|
||||
redmine_name: 'repo1-test',
|
||||
gitolite_repository_path: 'repositories/redmine/repo1-test.git',
|
||||
gitolite_full_repository_path: '/home/git/repositories/redmine/repo1-test.git',
|
||||
gitolite_repository_name: 'redmine/repo1-test',
|
||||
redmine_repository_path: 'repo1-test',
|
||||
new_repository_name: 'redmine/repo1-test',
|
||||
old_repository_name: 'redmine/repo1-test',
|
||||
http_user_login: '',
|
||||
git_access_path: 'redmine/repo1-test.git',
|
||||
http_access_path: 'git/repo1-test.git',
|
||||
ssh_url: "ssh://#{GIT_USER}@localhost/redmine/repo1-test.git",
|
||||
git_url: 'git://localhost/redmine/repo1-test.git',
|
||||
http_url: 'http://localhost/git/repo1-test.git',
|
||||
https_url: 'https://localhost/git/repo1-test.git',
|
||||
},
|
||||
|
||||
repository_3: {
|
||||
is_default: true,
|
||||
identifier: '',
|
||||
url: 'repositories/redmine/project-parent.git',
|
||||
root_url: 'repositories/redmine/project-parent.git',
|
||||
git_cache_id: 'project-parent',
|
||||
redmine_name: 'project-parent',
|
||||
gitolite_repository_path: 'repositories/redmine/project-parent.git',
|
||||
gitolite_full_repository_path: '/home/git/repositories/redmine/project-parent.git',
|
||||
gitolite_repository_name: 'redmine/project-parent',
|
||||
redmine_repository_path: 'project-parent',
|
||||
new_repository_name: 'redmine/project-parent',
|
||||
old_repository_name: 'redmine/project-parent',
|
||||
http_user_login: '',
|
||||
git_access_path: 'redmine/project-parent.git',
|
||||
http_access_path: 'git/project-parent.git',
|
||||
ssh_url: "ssh://#{GIT_USER}@localhost/redmine/project-parent.git",
|
||||
git_url: 'git://localhost/redmine/project-parent.git',
|
||||
http_url: 'http://localhost/git/project-parent.git',
|
||||
https_url: 'https://localhost/git/project-parent.git',
|
||||
},
|
||||
|
||||
repository_4: {
|
||||
is_default: false,
|
||||
identifier: 'repo2-test',
|
||||
url: 'repositories/redmine/repo2-test.git',
|
||||
root_url: 'repositories/redmine/repo2-test.git',
|
||||
git_cache_id: 'repo2-test',
|
||||
redmine_name: 'repo2-test',
|
||||
gitolite_repository_path: 'repositories/redmine/repo2-test.git',
|
||||
gitolite_full_repository_path: '/home/git/repositories/redmine/repo2-test.git',
|
||||
gitolite_repository_name: 'redmine/repo2-test',
|
||||
redmine_repository_path: 'repo2-test',
|
||||
new_repository_name: 'redmine/repo2-test',
|
||||
old_repository_name: 'redmine/repo2-test',
|
||||
http_user_login: '',
|
||||
git_access_path: 'redmine/repo2-test.git',
|
||||
http_access_path: 'git/repo2-test.git',
|
||||
ssh_url: "ssh://#{GIT_USER}@localhost/redmine/repo2-test.git",
|
||||
git_url: 'git://localhost/redmine/repo2-test.git',
|
||||
http_url: 'http://localhost/git/repo2-test.git',
|
||||
https_url: 'https://localhost/git/repo2-test.git',
|
||||
},
|
||||
}
|
||||
|
||||
def build_collection_of_unique_repositories
|
||||
@repository_1 = build_git_repository(project: @project_child, is_default: true)
|
||||
@repository_1.valid?
|
||||
@repository_2 = build_git_repository(project: @project_child, identifier: 'repo1-test')
|
||||
@repository_2.valid?
|
||||
|
||||
@repository_3 = build_git_repository(project: @project_parent, is_default: true)
|
||||
@repository_3.valid?
|
||||
@repository_4 = build_git_repository(project: @project_parent, identifier: 'repo2-test')
|
||||
@repository_4.valid?
|
||||
end
|
||||
|
||||
|
||||
def create_collection_of_unique_repositories
|
||||
@repository_1 = create_git_repository(project: @project_child, is_default: true)
|
||||
@repository_2 = create_git_repository(project: @project_child, identifier: 'repo1-test')
|
||||
|
||||
@repository_3 = create_git_repository(project: @project_parent, is_default: true)
|
||||
@repository_4 = create_git_repository(project: @project_parent, identifier: 'repo2-test')
|
||||
end
|
||||
|
||||
|
||||
context 'when flat_organisation with unique_identifier: fast tests' do
|
||||
before(:all) do
|
||||
Setting.plugin_redmine_git_hosting[:hierarchical_organisation] = 'false'
|
||||
Setting.plugin_redmine_git_hosting[:unique_repo_identifier] = 'true'
|
||||
build_collection_of_unique_repositories
|
||||
end
|
||||
|
||||
UNIQUE_REPOSITORIES_MATRIX.each do |repo, attributes|
|
||||
describe repo do
|
||||
attributes.each do |key, value|
|
||||
if value == true || value == false
|
||||
it { expect(instance_variable_get("@#{repo}").send(key)).to be value }
|
||||
else
|
||||
it { expect(instance_variable_get("@#{repo}").send(key)).to eq value }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context 'when flat_organisation with unique_identifier: long tests' do
|
||||
describe '.repo_ident_unique?' do
|
||||
it 'should be true' do
|
||||
Setting.plugin_redmine_git_hosting[:hierarchical_organisation] = 'false'
|
||||
Setting.plugin_redmine_git_hosting[:unique_repo_identifier] = 'true'
|
||||
expect(Repository::Xitolite.repo_ident_unique?).to be true
|
||||
end
|
||||
end
|
||||
|
||||
describe '.have_duplicated_identifier?' do
|
||||
it 'should be false' do
|
||||
Setting.plugin_redmine_git_hosting[:hierarchical_organisation] = 'false'
|
||||
Setting.plugin_redmine_git_hosting[:unique_repo_identifier] = 'true'
|
||||
create_collection_of_unique_repositories
|
||||
expect(Repository::Xitolite.have_duplicated_identifier?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
describe '.repo_path_to_git_cache_id' do
|
||||
before do
|
||||
Setting.plugin_redmine_git_hosting[:hierarchical_organisation] = 'false'
|
||||
Setting.plugin_redmine_git_hosting[:unique_repo_identifier] = 'true'
|
||||
create_collection_of_unique_repositories
|
||||
end
|
||||
|
||||
let(:repo1) { Repository::Xitolite.find_by_path(@repository_1.url, loose: true) }
|
||||
let(:repo2) { Repository::Xitolite.find_by_path(@repository_2.url, loose: true) }
|
||||
let(:repo3) { Repository::Xitolite.find_by_path(@repository_3.url, loose: true) }
|
||||
let(:repo4) { Repository::Xitolite.find_by_path(@repository_4.url, loose: true) }
|
||||
|
||||
let(:git_cache_id1) { Repository::Xitolite.repo_path_to_git_cache_id(@repository_1.url) }
|
||||
let(:git_cache_id2) { Repository::Xitolite.repo_path_to_git_cache_id(@repository_2.url) }
|
||||
let(:git_cache_id3) { Repository::Xitolite.repo_path_to_git_cache_id(@repository_3.url) }
|
||||
let(:git_cache_id4) { Repository::Xitolite.repo_path_to_git_cache_id(@repository_4.url) }
|
||||
|
||||
describe 'repositories should match' do
|
||||
it { expect(repo1).to eq @repository_1 }
|
||||
it { expect(repo2).to eq @repository_2 }
|
||||
it { expect(repo3).to eq @repository_3 }
|
||||
it { expect(repo4).to eq @repository_4 }
|
||||
|
||||
it { expect(git_cache_id1).to eq 'project-child' }
|
||||
it { expect(git_cache_id2).to eq 'repo1-test' }
|
||||
it { expect(git_cache_id3).to eq 'project-parent' }
|
||||
it { expect(git_cache_id4).to eq 'repo2-test' }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,106 +0,0 @@
|
|||
module GlobalHelpers
|
||||
def create_user_with_permissions(project, permissions: [], login: nil)
|
||||
role = Role.find_by_name('Manager')
|
||||
role = FactoryBot.create(:role, name: 'Manager') if role.nil?
|
||||
role.permissions += permissions
|
||||
role.save!
|
||||
|
||||
if login.nil?
|
||||
user = FactoryBot.create(:user)
|
||||
else
|
||||
user = FactoryBot.create(:user, login: login)
|
||||
end
|
||||
|
||||
member = Member.new(role_ids: [role.id], user_id: user.id)
|
||||
project.members << member
|
||||
|
||||
user
|
||||
end
|
||||
|
||||
|
||||
def create_project(identifier = nil)
|
||||
if identifier.nil?
|
||||
FactoryBot.create(:project)
|
||||
else
|
||||
project = Project.find_by_identifier(identifier)
|
||||
project = FactoryBot.create(:project, identifier: identifier) if project.nil?
|
||||
project
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def set_session_user(user)
|
||||
request.session[:user_id] = user.id
|
||||
end
|
||||
|
||||
|
||||
def create_anonymous_user
|
||||
create_user('git_anonymous')
|
||||
end
|
||||
|
||||
|
||||
def create_admin_user
|
||||
create_user('git_admin', admin: true)
|
||||
end
|
||||
|
||||
|
||||
def create_user(login, admin: false)
|
||||
user = User.find_by_login(login)
|
||||
user = FactoryBot.create(:user, login: login, admin: admin) if user.nil?
|
||||
user
|
||||
end
|
||||
|
||||
|
||||
def create_ssh_key(opts = {})
|
||||
FactoryBot.create(:gitolite_public_key, opts)
|
||||
end
|
||||
|
||||
|
||||
def build_ssh_key(opts = {})
|
||||
FactoryBot.build(:gitolite_public_key, opts)
|
||||
end
|
||||
|
||||
|
||||
def build_git_repository(opts = {})
|
||||
FactoryBot.build(:repository_gitolite, opts)
|
||||
end
|
||||
|
||||
|
||||
def find_or_create_git_repository(opts = {})
|
||||
repository = Repository::Xitolite.find_by_identifier(opts[:identifier])
|
||||
if repository.nil?
|
||||
repository = FactoryBot.create(:repository_gitolite, opts)
|
||||
build_extra(repository)
|
||||
end
|
||||
repository
|
||||
end
|
||||
|
||||
|
||||
def create_git_repository(opts = {})
|
||||
repository = FactoryBot.create(:repository_gitolite, opts)
|
||||
build_extra(repository)
|
||||
repository
|
||||
end
|
||||
|
||||
|
||||
def build_extra(repository)
|
||||
extra = repository.build_extra(default_branch: 'master', key: RedmineGitHosting::Utils::Crypto.generate_secret(64))
|
||||
extra.save!
|
||||
end
|
||||
|
||||
|
||||
def create_svn_repository(opts = {})
|
||||
FactoryBot.create(:repository_svn, opts)
|
||||
end
|
||||
|
||||
|
||||
def load_yaml_fixture(fixture)
|
||||
YAML::load(load_fixture(fixture))
|
||||
end
|
||||
|
||||
|
||||
def load_fixture(fixture)
|
||||
File.read(RedmineGitHosting.plugin_spec_dir('fixtures', fixture))
|
||||
end
|
||||
|
||||
end
|
|
@ -1,190 +0,0 @@
|
|||
RSpec.shared_context 'hierarchical_organisation' do
|
||||
|
||||
##############################################################
|
||||
# #
|
||||
# HIERARCHICAL ORGANISATION / NON-UNIQUE REPOSITORIES TESTS #
|
||||
# #
|
||||
##############################################################
|
||||
|
||||
NON_UNIQUE_REPOSITORIES_MATRIX = {
|
||||
repository_1: {
|
||||
is_default: true,
|
||||
identifier: '',
|
||||
url: 'repositories/redmine/project-parent/project-child.git',
|
||||
root_url: 'repositories/redmine/project-parent/project-child.git',
|
||||
git_cache_id: 'project-child',
|
||||
redmine_name: 'project-child',
|
||||
gitolite_repository_path: 'repositories/redmine/project-parent/project-child.git',
|
||||
gitolite_full_repository_path: '/home/git/repositories/redmine/project-parent/project-child.git',
|
||||
gitolite_repository_name: 'redmine/project-parent/project-child',
|
||||
redmine_repository_path: 'project-parent/project-child',
|
||||
new_repository_name: 'redmine/project-parent/project-child',
|
||||
old_repository_name: 'redmine/project-parent/project-child',
|
||||
http_user_login: '',
|
||||
git_access_path: 'redmine/project-parent/project-child.git',
|
||||
http_access_path: 'git/project-parent/project-child.git',
|
||||
ssh_url: "ssh://#{GIT_USER}@localhost/redmine/project-parent/project-child.git",
|
||||
git_url: 'git://localhost/redmine/project-parent/project-child.git',
|
||||
http_url: 'http://localhost/git/project-parent/project-child.git',
|
||||
https_url: 'https://localhost/git/project-parent/project-child.git',
|
||||
},
|
||||
|
||||
repository_2: {
|
||||
is_default: false,
|
||||
identifier: 'repo-test',
|
||||
url: 'repositories/redmine/project-parent/project-child/repo-test.git',
|
||||
root_url: 'repositories/redmine/project-parent/project-child/repo-test.git',
|
||||
git_cache_id: 'project-child/repo-test',
|
||||
redmine_name: 'repo-test',
|
||||
gitolite_repository_path: 'repositories/redmine/project-parent/project-child/repo-test.git',
|
||||
gitolite_full_repository_path: '/home/git/repositories/redmine/project-parent/project-child/repo-test.git',
|
||||
gitolite_repository_name: 'redmine/project-parent/project-child/repo-test',
|
||||
redmine_repository_path: 'project-parent/project-child/repo-test',
|
||||
new_repository_name: 'redmine/project-parent/project-child/repo-test',
|
||||
old_repository_name: 'redmine/project-parent/project-child/repo-test',
|
||||
http_user_login: '',
|
||||
git_access_path: 'redmine/project-parent/project-child/repo-test.git',
|
||||
http_access_path: 'git/project-parent/project-child/repo-test.git',
|
||||
ssh_url: "ssh://#{GIT_USER}@localhost/redmine/project-parent/project-child/repo-test.git",
|
||||
git_url: 'git://localhost/redmine/project-parent/project-child/repo-test.git',
|
||||
http_url: 'http://localhost/git/project-parent/project-child/repo-test.git',
|
||||
https_url: 'https://localhost/git/project-parent/project-child/repo-test.git',
|
||||
},
|
||||
|
||||
repository_3: {
|
||||
is_default: true,
|
||||
identifier: '',
|
||||
url: 'repositories/redmine/project-parent.git',
|
||||
root_url: 'repositories/redmine/project-parent.git',
|
||||
git_cache_id: 'project-parent',
|
||||
redmine_name: 'project-parent',
|
||||
gitolite_repository_path: 'repositories/redmine/project-parent.git',
|
||||
gitolite_full_repository_path: '/home/git/repositories/redmine/project-parent.git',
|
||||
gitolite_repository_name: 'redmine/project-parent',
|
||||
redmine_repository_path: 'project-parent',
|
||||
new_repository_name: 'redmine/project-parent',
|
||||
old_repository_name: 'redmine/project-parent',
|
||||
http_user_login: '',
|
||||
git_access_path: 'redmine/project-parent.git',
|
||||
http_access_path: 'git/project-parent.git',
|
||||
ssh_url: "ssh://#{GIT_USER}@localhost/redmine/project-parent.git",
|
||||
git_url: 'git://localhost/redmine/project-parent.git',
|
||||
http_url: 'http://localhost/git/project-parent.git',
|
||||
https_url: 'https://localhost/git/project-parent.git',
|
||||
},
|
||||
|
||||
repository_4: {
|
||||
is_default: false,
|
||||
identifier: 'repo-test',
|
||||
url: 'repositories/redmine/project-parent/repo-test.git',
|
||||
root_url: 'repositories/redmine/project-parent/repo-test.git',
|
||||
git_cache_id: 'project-parent/repo-test',
|
||||
redmine_name: 'repo-test',
|
||||
gitolite_repository_path: 'repositories/redmine/project-parent/repo-test.git',
|
||||
gitolite_full_repository_path: '/home/git/repositories/redmine/project-parent/repo-test.git',
|
||||
gitolite_repository_name: 'redmine/project-parent/repo-test',
|
||||
redmine_repository_path: 'project-parent/repo-test',
|
||||
new_repository_name: 'redmine/project-parent/repo-test',
|
||||
old_repository_name: 'redmine/project-parent/repo-test',
|
||||
http_user_login: '',
|
||||
git_access_path: 'redmine/project-parent/repo-test.git',
|
||||
http_access_path: 'git/project-parent/repo-test.git',
|
||||
ssh_url: "ssh://#{GIT_USER}@localhost/redmine/project-parent/repo-test.git",
|
||||
git_url: 'git://localhost/redmine/project-parent/repo-test.git',
|
||||
http_url: 'http://localhost/git/project-parent/repo-test.git',
|
||||
https_url: 'https://localhost/git/project-parent/repo-test.git',
|
||||
}
|
||||
}
|
||||
|
||||
def build_collection_of_non_unique_repositories
|
||||
@repository_1 = build_git_repository(project: @project_child, is_default: true)
|
||||
@repository_1.valid?
|
||||
@repository_2 = build_git_repository(project: @project_child, identifier: 'repo-test')
|
||||
@repository_2.valid?
|
||||
|
||||
@repository_3 = build_git_repository(project: @project_parent, is_default: true)
|
||||
@repository_3.valid?
|
||||
@repository_4 = build_git_repository(project: @project_parent, identifier: 'repo-test')
|
||||
@repository_4.valid?
|
||||
end
|
||||
|
||||
|
||||
def create_collection_of_non_unique_repositories
|
||||
@repository_1 = create_git_repository(project: @project_child, is_default: true)
|
||||
@repository_2 = create_git_repository(project: @project_child, identifier: 'repo-test')
|
||||
|
||||
@repository_3 = create_git_repository(project: @project_parent, is_default: true)
|
||||
@repository_4 = create_git_repository(project: @project_parent, identifier: 'repo-test')
|
||||
end
|
||||
|
||||
|
||||
context 'when hierarchical_organisation with non_unique_identifier: fast tests' do
|
||||
before(:all) do
|
||||
Setting.plugin_redmine_git_hosting[:hierarchical_organisation] = 'true'
|
||||
Setting.plugin_redmine_git_hosting[:unique_repo_identifier] = 'false'
|
||||
build_collection_of_non_unique_repositories
|
||||
end
|
||||
|
||||
NON_UNIQUE_REPOSITORIES_MATRIX.each do |repo, attributes|
|
||||
describe repo do
|
||||
attributes.each do |key, value|
|
||||
if value == true || value == false
|
||||
it { expect(instance_variable_get("@#{repo}").send(key)).to be value }
|
||||
else
|
||||
it { expect(instance_variable_get("@#{repo}").send(key)).to eq value }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context 'when hierarchical_organisation with non_unique_identifier: long tests' do
|
||||
describe '.repo_ident_unique?' do
|
||||
it 'should be false' do
|
||||
Setting.plugin_redmine_git_hosting[:hierarchical_organisation] = 'true'
|
||||
Setting.plugin_redmine_git_hosting[:unique_repo_identifier] = 'false'
|
||||
expect(Repository::Xitolite.repo_ident_unique?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
describe '.have_duplicated_identifier?' do
|
||||
it 'should be true' do
|
||||
Setting.plugin_redmine_git_hosting[:hierarchical_organisation] = 'true'
|
||||
Setting.plugin_redmine_git_hosting[:unique_repo_identifier] = 'false'
|
||||
create_collection_of_non_unique_repositories
|
||||
expect(Repository::Xitolite.have_duplicated_identifier?).to be true
|
||||
end
|
||||
end
|
||||
|
||||
describe '.repo_path_to_git_cache_id' do
|
||||
before do
|
||||
Setting.plugin_redmine_git_hosting[:hierarchical_organisation] = 'true'
|
||||
Setting.plugin_redmine_git_hosting[:unique_repo_identifier] = 'false'
|
||||
create_collection_of_non_unique_repositories
|
||||
end
|
||||
|
||||
let(:repo1) { Repository::Xitolite.find_by_path(@repository_1.url, loose: true) }
|
||||
let(:repo2) { Repository::Xitolite.find_by_path(@repository_2.url, loose: true) }
|
||||
let(:repo3) { Repository::Xitolite.find_by_path(@repository_3.url, loose: true) }
|
||||
let(:repo4) { Repository::Xitolite.find_by_path(@repository_4.url, loose: true) }
|
||||
|
||||
let(:git_cache_id1) { Repository::Xitolite.repo_path_to_git_cache_id(@repository_1.url) }
|
||||
let(:git_cache_id2) { Repository::Xitolite.repo_path_to_git_cache_id(@repository_2.url) }
|
||||
let(:git_cache_id3) { Repository::Xitolite.repo_path_to_git_cache_id(@repository_3.url) }
|
||||
let(:git_cache_id4) { Repository::Xitolite.repo_path_to_git_cache_id(@repository_4.url) }
|
||||
|
||||
describe 'repositories should match' do
|
||||
it { expect(repo1).to eq @repository_1 }
|
||||
it { expect(repo2).to eq @repository_2 }
|
||||
it { expect(repo3).to eq @repository_3 }
|
||||
it { expect(repo4).to eq @repository_4 }
|
||||
|
||||
it { expect(git_cache_id1).to eq 'project-child' }
|
||||
it { expect(git_cache_id2).to eq 'project-child/repo-test' }
|
||||
it { expect(git_cache_id3).to eq 'project-parent' }
|
||||
it { expect(git_cache_id4).to eq 'project-parent/repo-test' }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,56 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
||||
|
||||
describe RepositoryMirrors::Push do
|
||||
|
||||
let(:mirror_url) { 'ssh://git@redmine.example.org/project1/project2/project3/project4.git' }
|
||||
|
||||
|
||||
def build_mirror_pusher(opts = {})
|
||||
mirror = build(:repository_mirror, opts)
|
||||
RepositoryMirrors::Push.new(mirror)
|
||||
end
|
||||
|
||||
|
||||
describe 'Push args' do
|
||||
## Validate push args : forced mode
|
||||
context 'when push_mode forced with params' do
|
||||
it 'should have command' do
|
||||
mirror_pusher = build_mirror_pusher(url: mirror_url, push_mode: 1, explicit_refspec: 'devel')
|
||||
expect(mirror_pusher.command).to eq [mirror_url, 'devel', ['--force']]
|
||||
end
|
||||
end
|
||||
|
||||
## Validate push args : fast_forward mode
|
||||
context 'when push_mode fast_forward with params' do
|
||||
it 'should have command' do
|
||||
mirror_pusher = build_mirror_pusher(url: mirror_url, push_mode: 2, explicit_refspec: 'devel')
|
||||
expect(mirror_pusher.command).to eq [mirror_url, 'devel', []]
|
||||
end
|
||||
end
|
||||
|
||||
## Validate push args : mirror mode
|
||||
context 'when push_mode is mirror' do
|
||||
it 'should have command' do
|
||||
mirror_pusher = build_mirror_pusher(url: mirror_url, push_mode: 0)
|
||||
expect(mirror_pusher.command).to eq [mirror_url, nil, ['--mirror']]
|
||||
end
|
||||
end
|
||||
|
||||
## Validate push args : all tags mode
|
||||
context 'when push_mode is all tags' do
|
||||
it 'should have command' do
|
||||
mirror_pusher = build_mirror_pusher(url: mirror_url, push_mode: 1, include_all_tags: true)
|
||||
expect(mirror_pusher.command).to eq [mirror_url, nil, ['--force', '--tags']]
|
||||
end
|
||||
end
|
||||
|
||||
## Validate push args : all branches mode
|
||||
context 'when push_mode is all branches' do
|
||||
it 'should have command' do
|
||||
mirror_pusher = build_mirror_pusher(url: mirror_url, push_mode: 1, include_all_branches: true)
|
||||
expect(mirror_pusher.command).to eq [mirror_url, nil, ['--force', '--all']]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -1,151 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
||||
|
||||
describe RepositoryProtectedBranches::MemberManager do
|
||||
|
||||
def build_member_manager(opts = {})
|
||||
protected_branch = build(:repository_protected_branche)
|
||||
member_manager = RepositoryProtectedBranches::MemberManager.new(protected_branch)
|
||||
end
|
||||
|
||||
|
||||
let(:member_manager) { build_member_manager }
|
||||
|
||||
subject { member_manager }
|
||||
|
||||
describe '#current_user_ids' do
|
||||
it 'should return an array of user ids' do
|
||||
user = build(:user, id: 12)
|
||||
expect(member_manager.protected_branch).to receive(:users).and_return([user])
|
||||
expect(member_manager.current_user_ids).to eq [12]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe '#current_group_ids' do
|
||||
it 'should return an array of group ids' do
|
||||
group = build(:group, id: 12)
|
||||
expect(member_manager.protected_branch).to receive(:groups).and_return([group])
|
||||
expect(member_manager.current_group_ids).to eq [12]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe '#current_members' do
|
||||
it 'should return the current protected_branch members' do
|
||||
expect(member_manager.protected_branch).to receive(:protected_branches_members)
|
||||
member_manager.current_members
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe '#users_by_group_id' do
|
||||
it 'should return the members of a protected_branch group' do
|
||||
group_member = create(:protected_branch_group_member)
|
||||
user_member = create(:protected_branch_user_member, inherited_by: group_member.id)
|
||||
expect(member_manager).to receive(:current_members).and_return([user_member, group_member])
|
||||
expect(member_manager.users_by_group_id(1)).to eq [user_member.principal]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe '#add_users' do
|
||||
it 'should add users passed' do
|
||||
expect(member_manager).to receive(:current_user_ids).and_return([1])
|
||||
expect(member_manager).to receive(:create_member).with(['10'], [1], 'User', {})
|
||||
member_manager.add_users(['10'])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe '#add_groups' do
|
||||
it 'should add users passed' do
|
||||
user = build(:user, id: 42)
|
||||
group = build(:group, id: 10)
|
||||
expect(member_manager).to receive(:current_group_ids).and_return([])
|
||||
expect(member_manager).to receive(:create_group_member).with(['10'], []).and_yield(group)
|
||||
expect(group).to receive(:users).and_return([user])
|
||||
expect(member_manager).to receive(:users_by_group_id).and_return([])
|
||||
expect(member_manager).to receive(:create_user_member).with([42], [], inherited_by: 10, destroy: false)
|
||||
member_manager.add_groups(['10'])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe '#create_user_member' do
|
||||
it 'should create a new user member' do
|
||||
expect(member_manager).to receive(:create_member).with([1], [], 'User', {})
|
||||
member_manager.create_user_member([1], [])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe '#create_group_member' do
|
||||
it 'should create a new group member' do
|
||||
expect(member_manager).to receive(:create_member).with([1], [], 'Group', {})
|
||||
member_manager.create_group_member([1], [])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe '#add_user_from_group' do
|
||||
it 'should add a user from a group' do
|
||||
user1 = build(:user, id: 20)
|
||||
user2 = build(:user, id: 22)
|
||||
expect(member_manager).to receive(:users_by_group_id).once.with(10).and_return([user2])
|
||||
expect(member_manager).to receive(:users_by_group_id).once.with(10).and_return([user2])
|
||||
expect(member_manager).to receive(:create_user_member).with([user2.id, user1.id], [user2.id], inherited_by: 10, destroy: false)
|
||||
member_manager.add_user_from_group(user1, 10)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe '#remove_user_from_group' do
|
||||
context 'when user exists' do
|
||||
it 'should remove a user from a group' do
|
||||
user = build(:user)
|
||||
expect(member_manager).to receive(:users_by_group_id).with(10).and_return([user])
|
||||
expect(member_manager.current_members).to receive(:find_by_protected_branch_id_and_principal_id_and_inherited_by)
|
||||
member_manager.remove_user_from_group(user, 10)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user doesnt no exist' do
|
||||
it 'should return' do
|
||||
user = build(:user)
|
||||
expect(member_manager).to receive(:users_by_group_id).with(10).and_return([])
|
||||
expect(member_manager.current_members).to_not receive(:find_by_protected_branch_id_and_principal_id_and_inherited_by)
|
||||
member_manager.remove_user_from_group(user, 10)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe '#create_member' do
|
||||
it 'should create member' do
|
||||
user = build(:user, id: 12)
|
||||
expect(User).to receive(:find_by_id).with(12).and_return(user)
|
||||
expect(member_manager.current_members).to receive(:create).with(principal_id: user.id, inherited_by: 10)
|
||||
expect(member_manager.current_members).to receive(:select).and_return([])
|
||||
member_manager.create_member([12], [], 'User', inherited_by: 10)
|
||||
end
|
||||
|
||||
context 'when member is a user' do
|
||||
it 'should create member' do
|
||||
user = build(:user, id: 12)
|
||||
expect(User).to receive(:find_by_id).with(12).and_return(user)
|
||||
expect(member_manager.current_members).to receive(:create).with(principal_id: user.id, inherited_by: 10)
|
||||
member_manager.create_member([12], [], 'User', inherited_by: 10, destroy: false)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when member is a group' do
|
||||
it 'should create member' do
|
||||
group = build(:group, id: 12)
|
||||
expect(Group).to receive(:find_by_id).with(12).and_return(group)
|
||||
expect(member_manager.current_members).to receive(:create).with(principal_id: group.id, inherited_by: nil)
|
||||
member_manager.create_member([12], [], 'Group', destroy: false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue