mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-11 17:36:13 +08:00
Merge branch 'czbiohub-mc-SCI-2704' into core-api
This commit is contained in:
commit
d21ec35cfc
1 changed files with 32 additions and 0 deletions
|
@ -254,4 +254,36 @@ RSpec.describe "Api::V1::InventoriesController", type: :request do
|
||||||
expect(hash_body).to match({})
|
expect(hash_body).to match({})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'DELETE inventories, #destroy' do
|
||||||
|
it 'Destroys inventory' do
|
||||||
|
deleted_id = @teams.first.repositories.last.id
|
||||||
|
delete api_v1_team_inventory_path(
|
||||||
|
id: deleted_id,
|
||||||
|
team_id: @teams.first.id
|
||||||
|
), headers: @valid_headers
|
||||||
|
expect(response).to have_http_status(200)
|
||||||
|
expect(Repository.where(id: deleted_id)).to_not exist
|
||||||
|
expect(RepositoryRow.where(repository: deleted_id).count).to equal 0
|
||||||
|
expect(RepositoryColumn.where(repository: deleted_id).count).to equal 0
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'Invalid request, non existing inventory' do
|
||||||
|
delete api_v1_team_inventory_path(
|
||||||
|
id: 123,
|
||||||
|
team_id: @teams.first.id
|
||||||
|
), headers: @valid_headers
|
||||||
|
expect(response).to have_http_status(404)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'When invalid request, repository from another team' do
|
||||||
|
deleted_id = @teams.first.repositories.last.id
|
||||||
|
delete api_v1_team_inventory_path(
|
||||||
|
id: deleted_id,
|
||||||
|
team_id: @teams.second.id
|
||||||
|
), headers: @valid_headers
|
||||||
|
expect(response).to have_http_status(403)
|
||||||
|
expect(Repository.where(id: deleted_id)).to exist
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue