#472: Update the Projects::BuildListsController and Api::V1::BuildListsController
This commit is contained in:
parent
ca22bbc632
commit
0b05e688c8
|
@ -2,7 +2,7 @@ class BuildList::Item < ActiveRecord::Base
|
||||||
|
|
||||||
belongs_to :build_list, touch: true
|
belongs_to :build_list, touch: true
|
||||||
|
|
||||||
attr_protected :build_list_id
|
# attr_protected :build_list_id
|
||||||
|
|
||||||
GIT_ERROR = 5
|
GIT_ERROR = 5
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ class Collaborator
|
||||||
include ActiveModel::Validations
|
include ActiveModel::Validations
|
||||||
include ActiveModel::Serializers::JSON
|
include ActiveModel::Serializers::JSON
|
||||||
# include ActiveModel::MassAssignmentSecurity
|
# include ActiveModel::MassAssignmentSecurity
|
||||||
include ActiveModel::ForbiddenAttributesProtection
|
|
||||||
extend ActiveModel::Naming
|
extend ActiveModel::Naming
|
||||||
|
|
||||||
attr_accessor :role, :actor, :project, :relation
|
attr_accessor :role, :actor, :project, :relation
|
||||||
|
|
|
@ -61,7 +61,7 @@ class BuildListPolicy < ApplicationPolicy
|
||||||
#
|
#
|
||||||
# Returns Array
|
# Returns Array
|
||||||
def permitted_attributes
|
def permitted_attributes
|
||||||
%i(
|
pa = %i(
|
||||||
arch_id
|
arch_id
|
||||||
auto_create_container
|
auto_create_container
|
||||||
auto_publish
|
auto_publish
|
||||||
|
@ -69,20 +69,23 @@ class BuildListPolicy < ApplicationPolicy
|
||||||
build_for_platform_id
|
build_for_platform_id
|
||||||
commit_hash
|
commit_hash
|
||||||
external_nodes
|
external_nodes
|
||||||
extra_build_lists
|
|
||||||
extra_params
|
|
||||||
extra_repositories
|
|
||||||
include_repos
|
|
||||||
include_testing_subrepository
|
include_testing_subrepository
|
||||||
project_id
|
project_id
|
||||||
project_version
|
project_version
|
||||||
save_buildroot
|
save_buildroot
|
||||||
save_to_platform_id
|
save_to_platform_id
|
||||||
save_to_repository_id
|
save_to_repository_id
|
||||||
update_type,
|
update_type
|
||||||
use_cached_chroot
|
use_cached_chroot
|
||||||
use_extra_tests
|
use_extra_tests
|
||||||
)
|
)
|
||||||
|
pa << {
|
||||||
|
include_repos: [],
|
||||||
|
extra_build_lists: [],
|
||||||
|
extra_repositories: [],
|
||||||
|
extra_params: BuildList::EXTRA_PARAMS,
|
||||||
|
}
|
||||||
|
pa
|
||||||
end
|
end
|
||||||
|
|
||||||
class Scope < Scope
|
class Scope < Scope
|
||||||
|
|
|
@ -533,7 +533,8 @@ describe Api::V1::BuildListsController, type: :controller do
|
||||||
@another_user = FactoryGirl.create(:user)
|
@another_user = FactoryGirl.create(:user)
|
||||||
@build_list.update_column(:status, BuildList::SUCCESS)
|
@build_list.update_column(:status, BuildList::SUCCESS)
|
||||||
@build_list.save_to_repository.update_column(:publish_without_qa, true)
|
@build_list.save_to_repository.update_column(:publish_without_qa, true)
|
||||||
@build_list.project.collaborators.create(actor_type: 'User', actor_id: @another_user.id, role: 'reader')
|
Collaborator.create(actor_type: 'User', actor_id: @another_user.id, role: 'reader', project: @build_list.project)
|
||||||
|
|
||||||
http_login(@another_user)
|
http_login(@another_user)
|
||||||
do_reject_publish
|
do_reject_publish
|
||||||
end
|
end
|
||||||
|
|
|
@ -165,7 +165,7 @@ describe Projects::BuildListsController, type: :controller do
|
||||||
|
|
||||||
it 'returns an error if user is project reader' do
|
it 'returns an error if user is project reader' do
|
||||||
@another_user = FactoryGirl.create(:user)
|
@another_user = FactoryGirl.create(:user)
|
||||||
@build_list.project.collaborators.create(actor_type: 'User', actor_id: @another_user.id, role: 'reader')
|
Collaborator.create(actor_type: 'User', actor_id: @another_user.id, role: 'reader', project: @build_list.project)
|
||||||
set_session_for(@another_user)
|
set_session_for(@another_user)
|
||||||
|
|
||||||
expect_any_instance_of(BuildList).to_not receive(:rerun_tests)
|
expect_any_instance_of(BuildList).to_not receive(:rerun_tests)
|
||||||
|
@ -245,7 +245,7 @@ describe Projects::BuildListsController, type: :controller do
|
||||||
@another_user = FactoryGirl.create(:user)
|
@another_user = FactoryGirl.create(:user)
|
||||||
@build_list.update_column(:status, BuildList::SUCCESS)
|
@build_list.update_column(:status, BuildList::SUCCESS)
|
||||||
@build_list.save_to_repository.update_column(:publish_without_qa, true)
|
@build_list.save_to_repository.update_column(:publish_without_qa, true)
|
||||||
@build_list.project.collaborators.create(actor_type: 'User', actor_id: @another_user.id, role: 'reader')
|
Collaborator.create(actor_type: 'User', actor_id: @another_user.id, role: 'reader', project: @build_list.project)
|
||||||
set_session_for(@another_user)
|
set_session_for(@another_user)
|
||||||
do_reject_publish
|
do_reject_publish
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue