Skip to content

Commit

Permalink
Fix availability of methods for project export API
Browse files Browse the repository at this point in the history
  • Loading branch information
NARKOZ committed Jun 13, 2024
1 parent dbd1c92 commit c244876
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions lib/gitlab/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class Client < API
include Pipelines
include ProjectBadges
include ProjectClusters
include ProjectExports
include ProjectReleaseLinks
include ProjectReleases
include Projects
Expand Down
6 changes: 3 additions & 3 deletions spec/gitlab/client/project_releases_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@

describe '.project_latest_release' do
before do
stub_get('/projects/3/releases/permalink/latest', 'project_latest_release')
stub_get('/projects/3/releases/permalink/latest', 'project_release')
@project_latest_release = Gitlab.project_latest_release(3)
end

it 'gets the correct resource' do
expect(a_get('/projects/3/releases/v0.1')).to have_been_made
expect(a_get('/projects/3/releases/permalink/latest')).to have_been_made
end

it 'returns information about a release' do
expect(@project_release.tag_name).to eq('v0.1')
expect(@project_latest_release.tag_name).to eq('v0.1')
end
end

Expand Down
20 changes: 10 additions & 10 deletions spec/gitlab/client/users_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -720,34 +720,34 @@

describe '.memberships' do
before do
stub_get('/user/2/memberships', 'memberships')
stub_get('/users/2/memberships', 'memberships')
@memberships = Gitlab.memberships(2)
end

it 'gets the correct resource' do
expect(a_get('/user/2/memberships')).to have_been_made
expect(a_get('/users/2/memberships')).to have_been_made
end

it 'returns an information about all project and groups of user' do
expect(@memberships.first.source_id).to eq 1
expect(@memberships.first.source_name).to eq 'Project one'
expect(@memberships.first.source_type).to eq 'Project'
expect(@memberships.first.access_level).to eq 20
expect(@memberships.first.access_level).to eq '20'
end
end

describe 'get all personal access tokens' do
describe 'get all' do
before do
stub_get('/user_personal_access_tokens?user_id=2', 'personal_access_get_all')
@token = Gitlab.user_personal_access_tokens(2)
stub_get('/personal_access_tokens?user_id=2', 'personal_access_get_all')
@tokens = Gitlab.user_personal_access_tokens(2)
end

it 'gets the correct resource' do
expect(a_get('/personal_access_tokens?user_id=2')).to have_been_made
end

it 'gets an array of user impersonation tokens' do
it 'gets an array of user personal access tokens' do
expect(@tokens.first.id).to eq(2)
expect(@tokens.last.id).to eq(3)
expect(@tokens.first.active).to be_truthy
Expand All @@ -758,12 +758,12 @@

describe 'create personal access token' do
before do
stub_post('/user/personal_access_tokens/', 'personal_access_create')
stub_post('/users/2/personal_access_tokens', 'personal_access_create')
@token = Gitlab.create_personal_access_token(2, 'service_account_2', ['api'])
end

it 'gets the correct resource' do
expect(a_post('/user/personal_access_tokens').with(body: 'name=service_account_2&scopes%5B%5D=api')).to have_been_made
expect(a_post('/users/2/personal_access_tokens').with(body: 'name=service_account_2&scopes%5B%5D=api')).to have_been_made
end

it 'returns a valid personal access token' do
Expand Down Expand Up @@ -795,12 +795,12 @@
end
end

describe 'revoke personal accees token' do
describe 'revoke personal access token' do
before do
stub_request(:delete, "#{Gitlab.endpoint}/personal_access_tokens/2")
.with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token })
.to_return(status: 204)
@token = Gitlab.revoke_user_impersonation_token(2)
@token = Gitlab.revoke_personal_access_token(2)
end

it 'revokes a personal access token' do
Expand Down

0 comments on commit c244876

Please sign in to comment.