Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
GitLab
管理
动态
成员
标记
计划
议题
议题看板
里程碑
迭代
需求
代码
合并请求
仓库
分支
提交
标签
仓库图
比较修订版本
代码片段
锁定的文件
构建
流水线
作业
流水线计划
测试用例
产物
部署
发布
Package registry
Container registry
模型注册表
运维
环境
Terraform 模块
监控
事件
服务台
分析
价值流分析
贡献者分析
CI/CD 分析
仓库分析
代码评审分析
议题分析
洞察
模型实验
效能分析
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
显示更多面包屑
gitlab-cn
GitLab
提交
37cdf991
未验证
提交
37cdf991
编辑于
1 year ago
作者:
Alexander Turinske
提交者:
GitLab
1 year ago
浏览文件
操作
下载
补丁
差异文件
Create project feature tests for policies list
- test appearance of policies in policy list
上级
6884d705
No related branches found
No related tags found
无相关合并请求
变更
2
隐藏空白变更内容
行内
左右并排
显示
2 个更改的文件
ee/spec/features/groups/security/policies_list_spec.rb
+51
-0
51 个添加, 0 个删除
ee/spec/features/groups/security/policies_list_spec.rb
ee/spec/features/projects/security/policies_list_spec.rb
+55
-0
55 个添加, 0 个删除
ee/spec/features/projects/security/policies_list_spec.rb
有
106 个添加
和
0 个删除
ee/spec/features/groups/security/policies_list_spec.rb
0 → 100644
+
51
−
0
浏览文件 @
37cdf991
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
"User sees policies list"
,
:js
,
feature_category: :security_policy_management
do
let_it_be
(
:owner
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
owner
.
namespace
)
}
let_it_be
(
:policy_management_project
)
{
create
(
:project
,
:repository
,
namespace:
owner
.
namespace
)
}
let_it_be
(
:policy_configuration
)
do
create
(
:security_orchestration_policy_configuration
,
:namespace
,
security_policy_management_project:
policy_management_project
,
namespace:
group
)
end
let_it_be
(
:project_scan_execution_policy_pipeline
)
do
build
(
:scan_execution_policy
,
name:
"Enforce SAST everyday for every project"
)
end
let_it_be
(
:policy_yaml
)
do
Gitlab
::
Config
::
Loader
::
Yaml
.
new
(
fixture_file
(
'security_orchestration.yml'
,
dir:
'ee'
)).
load!
end
before_all
do
group
.
add_owner
(
user
)
policy_management_project
.
add_owner
(
user
)
end
before
do
allow_next_found_instance_of
(
Security
::
OrchestrationPolicyConfiguration
)
do
|
policy
|
allow
(
policy
).
to
receive
(
:policy_configuration_valid?
).
and_return
(
true
)
allow
(
policy
).
to
receive
(
:policy_hash
).
and_return
(
policy_yaml
)
allow
(
policy
).
to
receive
(
:policy_last_updated_at
).
and_return
(
Time
.
current
)
end
sign_in
(
user
)
stub_licensed_features
(
security_orchestration_policies:
true
)
end
it
"shows the policies list with policies"
do
visit
(
group_security_policies_path
(
group
))
# Scan Execution Policy from ee/spec/fixtures/security_orchestration.yml
expect
(
page
).
to
have_content
'Run DAST in every pipeline'
# Scan Result Policy from ee/spec/fixtures/security_orchestration.yml
expect
(
page
).
to
have_content
'critical vulnerability CS approvals'
end
end
此差异已折叠。
点击以展开。
ee/spec/features/projects/security/policies_list_spec.rb
0 → 100644
+
55
−
0
浏览文件 @
37cdf991
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
"User sees policies list"
,
:js
,
feature_category: :security_policy_management
do
let_it_be
(
:owner
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
owner
.
namespace
)
}
let_it_be
(
:policy_management_project
)
{
create
(
:project
,
:repository
,
namespace:
owner
.
namespace
)
}
let_it_be
(
:policy_configuration
)
do
create
(
:security_orchestration_policy_configuration
,
security_policy_management_project:
policy_management_project
,
project:
project
)
end
let_it_be
(
:project_scan_execution_policy_pipeline
)
do
build
(
:scan_execution_policy
,
name:
"Enforce SAST everyday for every project"
)
end
let_it_be
(
:policy_yaml
)
do
Gitlab
::
Config
::
Loader
::
Yaml
.
new
(
fixture_file
(
'security_orchestration.yml'
,
dir:
'ee'
)).
load!
end
before_all
do
project
.
add_owner
(
user
)
policy_management_project
.
add_owner
(
user
)
end
before
do
allow_next_found_instance_of
(
Security
::
OrchestrationPolicyConfiguration
)
do
|
policy
|
allow
(
policy
).
to
receive
(
:policy_configuration_valid?
).
and_return
(
true
)
allow
(
policy
).
to
receive
(
:policy_hash
).
and_return
(
policy_yaml
)
allow
(
policy
).
to
receive
(
:policy_last_updated_at
).
and_return
(
Time
.
current
)
end
sign_in
(
user
)
stub_licensed_features
(
security_orchestration_policies:
true
)
end
it
"shows the policies list with policies"
do
visit
(
project_security_policies_path
(
project
))
# Scan Execution Policy from ee/spec/fixtures/security_orchestration.yml
expect
(
page
).
to
have_content
'Run DAST in every pipeline'
# Scan Result Policy from ee/spec/fixtures/security_orchestration.yml
expect
(
page
).
to
have_content
'critical vulnerability CS approvals'
end
it
"removes a policy project"
do
visit
(
project_security_policies_path
(
project
))
click_button
'Edit policy project'
click_button
'Unlink project'
click_button
'Save'
expect
(
page
).
not_to
have_content
'Run DAST in every pipeline'
expect
(
page
).
not_to
have_content
'critical vulnerability CS approvals'
end
end
此差异已折叠。
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录