Skip to content
Snippets Groups Projects
Commit 70bf4fa0 authored by Alexander Turinske's avatar Alexander Turinske Committed by Alexis Kalderimis
Browse files

Create policies_controller#new action and route

- add tests
- update locale
parent 51398378
No related branches found
No related tags found
No related merge requests found
- add_to_breadcrumbs s_("SecurityPolicies|Policies"), project_security_policy_path(@project)
- breadcrumb_title s_("SecurityPolicies|Edit policy")
- page_title s_("SecurityPolicies|Edit policy")
- add_to_breadcrumbs s_("SecurityOrchestration|Policies"), project_security_policy_path(@project)
- breadcrumb_title s_("SecurityOrchestration|Edit policy")
- page_title s_("SecurityOrchestration|Edit policy")
 
#js-policy-builder-app{ data: { policy: @policy.to_json,
policy_type: @policy_type,
Loading
Loading
- add_to_breadcrumbs s_("SecurityOrchestration|Policies"), project_security_policy_path(@project)
- breadcrumb_title s_("SecurityOrchestration|New policy")
- page_title s_("SecurityOrchestration|Policy editor")
- policy_details = policy_details(@project)
#js-policy-builder-app{ data: policy_details }
Loading
Loading
@@ -8,6 +8,6 @@
disable_security_policy_project: disable_security_policy_project.to_s,
documentation_path: help_page_path('user/application_security/policies/index.md'),
empty_state_svg_path: image_path('illustrations/monitoring/unable_to_connect.svg'),
new_policy_path: new_project_threat_monitoring_policy_path(project),
new_policy_path: new_project_security_policy_path(project),
environments_endpoint: project_environments_path(project),
project_path: project.full_path } }
Loading
Loading
@@ -62,7 +62,7 @@
 
resource :policy, only: [:show]
 
resources :policies, only: [:edit], controller: :policies, constraints: { id: %r{[^/]+} }
resources :policies, only: [:new, :edit], controller: :policies, constraints: { id: %r{[^/]+} }
 
resource :configuration, only: [], controller: :configuration do
post :auto_fix, on: :collection
Loading
Loading
Loading
Loading
@@ -23,6 +23,7 @@
let_it_be(:type) { 'scan_execution_policy' }
let_it_be(:show) { project_security_policy_url(project) }
let_it_be(:edit) { edit_project_security_policy_url(project, id: policy[:name], type: type) }
let_it_be(:new) { new_project_security_policy_url(project) }
 
let_it_be(:feature_enabled) { true }
 
Loading
Loading
@@ -155,6 +156,32 @@
end
end
 
describe 'GET #new' do
using RSpec::Parameterized::TableSyntax
where(:feature_flag, :license, :status) do
true | true | :ok
false | false | :not_found
false | true | :not_found
true | false | :not_found
end
subject(:request) { get new, params: { namespace_id: project.namespace, project_id: project } }
with_them do
before do
stub_feature_flags(security_orchestration_policies_configuration: feature_flag)
stub_licensed_features(security_orchestration_policies: license)
end
specify do
subject
expect(response).to have_gitlab_http_status(status)
end
end
end
describe 'GET #show' do
using RSpec::Parameterized::TableSyntax
 
Loading
Loading
Loading
Loading
@@ -70,6 +70,10 @@
%w[test.1.2 test-policy test:policy]
end
 
it "to #new" do
expect(get("/gitlab/gitlabhq/-/security/policies/new")).to route_to('projects/security/policies#new', namespace_id: 'gitlab', project_id: 'gitlabhq')
end
it 'to #show' do
expect(get('/gitlab/gitlabhq/-/security/policy')).to route_to('projects/security/policies#show', namespace_id: 'gitlab', project_id: 'gitlabhq')
end
Loading
Loading
Loading
Loading
@@ -29528,6 +29528,9 @@ msgstr ""
msgid "SecurityOrchestration|An error occurred assigning your security policy project"
msgstr ""
 
msgid "SecurityOrchestration|Edit policy"
msgstr ""
msgid "SecurityOrchestration|Edit policy project"
msgstr ""
 
Loading
Loading
@@ -29543,6 +29546,9 @@ msgstr ""
msgid "SecurityOrchestration|Policies"
msgstr ""
 
msgid "SecurityOrchestration|Policy editor"
msgstr ""
msgid "SecurityOrchestration|Security policy project was linked successfully"
msgstr ""
 
Loading
Loading
@@ -29567,9 +29573,6 @@ msgstr ""
msgid "SecurityPolicies|Description"
msgstr ""
 
msgid "SecurityPolicies|Edit policy"
msgstr ""
msgid "SecurityPolicies|Enforcement status"
msgstr ""
 
Loading
Loading
@@ -29582,9 +29585,6 @@ msgstr ""
msgid "SecurityPolicies|Network"
msgstr ""
 
msgid "SecurityPolicies|Policies"
msgstr ""
msgid "SecurityPolicies|Policy type"
msgstr ""
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment