feat: common attachment endpoint follow-up changes (#7826)

This commit is contained in:
Shivam Mishra
2023-09-01 15:18:48 +07:00
committed by GitHub
parent 2acf09b3eb
commit 9ebabb9832
14 changed files with 11 additions and 114 deletions

View File

@@ -210,33 +210,4 @@ RSpec.describe 'Api::V1::Accounts::Portals', type: :request do
end
end
end
describe 'POST /api/v1/accounts/{account.id}/portals/attach_file' do
it 'update the portal with a logo' do
file = fixture_file_upload(Rails.root.join('spec/assets/avatar.png'), 'image/png')
post "/api/v1/accounts/#{account.id}/portals/attach_file",
headers: admin.create_new_auth_token,
params: { logo: file }
expect(response).to have_http_status(:success)
blob = response.parsed_body
expect(blob['blob_key']).to be_present
expect(blob['blob_id']).to be_present
params = { blob_id: blob['blob_id'] }
expect(portal.logo.attachment).not_to be_present
patch "/api/v1/accounts/#{account.id}/portals/#{portal.slug}",
headers: admin.create_new_auth_token,
params: params
portal.reload
expect(portal.logo.presence).to be_truthy
expect(portal.logo.attachment).to be_present
end
end
end