Skip to content
代码片段 群组 项目
提交 3b079937 编辑于 作者: Sanad Liaquat's avatar Sanad Liaquat
浏览文件

E2E: Use UI to create top-level group

上级 eec78b1f
No related branches found
No related tags found
无相关合并请求
...@@ -4,6 +4,7 @@ module QA ...@@ -4,6 +4,7 @@ module QA
RSpec.describe 'Manage' do RSpec.describe 'Manage' do
# TODO: `:reliable` should be added back once https://gitlab.com/gitlab-org/gitlab/-/issues/359278 is resolved # TODO: `:reliable` should be added back once https://gitlab.com/gitlab-org/gitlab/-/issues/359278 is resolved
describe 'User', :requires_admin, product_group: :authentication_and_authorization do describe 'User', :requires_admin, product_group: :authentication_and_authorization do
# rubocop:disable RSpec/InstanceVariable
before(:all) do before(:all) do
admin_api_client = Runtime::API::Client.as_admin admin_api_client = Runtime::API::Client.as_admin
...@@ -11,21 +12,30 @@ module QA ...@@ -11,21 +12,30 @@ module QA
@user_api_client = Runtime::API::Client.new(:gitlab, user: @user) @user_api_client = Runtime::API::Client.new(:gitlab, user: @user)
@sandbox = create(:sandbox, path: "sandbox-for-access-termination-#{SecureRandom.hex(4)}", api_client: admin_api_client) # Use UI to create the top-level group as the `top_level_group_creation_enabled` feature flag
# could be disabled on live environments
@sandbox = Resource::Sandbox.fabricate! do |sandbox_group|
sandbox_group.path = "sandbox-for-access-termination-#{SecureRandom.hex(4)}"
end
group = create(:group, path: "group-to-test-access-termination-#{SecureRandom.hex(8)}", sandbox: @sandbox, api_client: admin_api_client) group = create(:group, path: "group-to-test-access-termination-#{SecureRandom.hex(8)}", sandbox: @sandbox)
@sandbox.add_member(@user) @sandbox.add_member(@user)
@project = create(:project, :with_readme, name: 'project-for-user-group-access-termination', group: group, api_client: admin_api_client) @project = create(:project, :with_readme, name: 'project-for-user-group-access-termination', group: group)
end
after(:all) do
@sandbox.remove_via_api!
end end
context 'after parent group membership termination' do context 'when parent group membership is terminated' do
before do before do
@sandbox.remove_member(@user) @sandbox.remove_member(@user)
end end
it 'is not allowed to push code via the CLI', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347863' do it 'is not allowed to push code via the CLI',
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347863' do
QA::Support::Retrier.retry_on_exception(max_attempts: 5, sleep_interval: 2) do QA::Support::Retrier.retry_on_exception(max_attempts: 5, sleep_interval: 2) do
expect do expect do
Resource::Repository::Push.fabricate! do |push| Resource::Repository::Push.fabricate! do |push|
...@@ -40,7 +50,8 @@ module QA ...@@ -40,7 +50,8 @@ module QA
end end
end end
it 'is not allowed to create a file via the API', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347864' do it 'is not allowed to create a file via the API',
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347864' do
QA::Support::Retrier.retry_on_exception(max_attempts: 5, sleep_interval: 2) do QA::Support::Retrier.retry_on_exception(max_attempts: 5, sleep_interval: 2) do
expect do expect do
create(:file, create(:file,
...@@ -51,7 +62,8 @@ module QA ...@@ -51,7 +62,8 @@ module QA
end end
end end
it 'is not allowed to commit via the API', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347865' do it 'is not allowed to commit via the API',
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347865' do
QA::Support::Retrier.retry_on_exception(max_attempts: 5, sleep_interval: 2) do QA::Support::Retrier.retry_on_exception(max_attempts: 5, sleep_interval: 2) do
expect do expect do
Resource::Repository::Commit.fabricate_via_api! do |commit| Resource::Repository::Commit.fabricate_via_api! do |commit|
...@@ -62,14 +74,12 @@ module QA ...@@ -62,14 +74,12 @@ module QA
commit.commit_message = 'Add new file' commit.commit_message = 'Add new file'
commit.add_files([{ file_path: 'test.txt', content: 'new file' }]) commit.add_files([{ file_path: 'test.txt', content: 'new file' }])
end end
end.to raise_error(Resource::ApiFabricator::ResourceFabricationFailedError, /403 Forbidden - You are not allowed to push into this branch/) end.to raise_error(Resource::ApiFabricator::ResourceFabricationFailedError,
/403 Forbidden - You are not allowed to push into this branch/)
end end
end end
end end
# rubocop:enable RSpec/InstanceVariable
after(:all) do
@sandbox.remove_via_api!
end
end end
end end
end end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册