blob: d730e1a80d4845830ff061dfcb17d16e36f3a242 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# frozen_string_literal: true
module QA
RSpec.describe 'Manage' do
describe 'Group access token', product_group: :authentication_and_authorization do
let(:group_access_token) { create(:group_access_token) }
let(:api_client) { Runtime::API::Client.new(:gitlab, personal_access_token: group_access_token.token) }
let(:project) do
Resource::Project.fabricate! do |project|
project.name = 'project-for-group-access-token'
project.group = group_access_token.group
project.initialize_with_readme = true
end
end
it(
'can be used to create a file via the project API',
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/367064'
) do
expect do
create(:file,
api_client: api_client,
project: project,
branch: "new_branch_#{SecureRandom.hex(8)}")
rescue StandardError => e
QA::Runtime::Logger.error("Full failure message: #{e.message}")
raise
end.not_to raise_error
end
it(
'can be used to commit via the API',
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/367067',
quarantine: {
type: :flaky,
issue: "https://gitlab.com/gitlab-org/gitlab/-/issues/396615"
}
) do
expect do
Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.api_client = api_client
commit.project = project
commit.branch = "new_branch_#{SecureRandom.hex(8)}"
commit.start_branch = project.default_branch
commit.commit_message = 'Add new file'
commit.add_files([{ file_path: "text-#{SecureRandom.hex(8)}.txt", content: 'new file' }])
end
rescue StandardError => e
QA::Runtime::Logger.error("Full failure message: #{e.message}")
raise
end.not_to raise_error
end
end
end
end
|