Added one more endpoint to attach tempfile and get logo (#6407)

This commit is contained in:
Tejaswini Chile
2023-02-09 14:05:45 +05:30
committed by GitHub
parent 0a7a5abec1
commit c5b245977a
8 changed files with 90 additions and 10 deletions

View File

@@ -232,5 +232,23 @@ RSpec.describe 'Api::V1::Accounts::Articles', type: :request do
expect(json_response['payload']['id']).to eq(root_article.id)
end
end
describe 'Upload an image' do
let(:article) { create(:article, account_id: account.id, category_id: category.id, portal_id: portal.id, author_id: agent.id) }
it 'update the article with an image' do
file = fixture_file_upload(Rails.root.join('spec/assets/avatar.png'), 'image/png')
post "/api/v1/accounts/#{account.id}/portals/#{article.portal.slug}/articles/attach_file",
headers: agent.create_new_auth_token,
params: { background_image: file }
expect(response).to have_http_status(:success)
blob = JSON.parse(response.body)
expect(blob['file_url']).to be_present
end
end
end
end