feat: Add upload under account scope (#7914)
This commit is contained in:
@@ -128,7 +128,7 @@ RSpec.describe 'Api::V1::Accounts::AutomationRulesController', type: :request do
|
||||
|
||||
expect(account.automation_rules.count).to eq(0)
|
||||
|
||||
post '/api/v1/upload',
|
||||
post "/api/v1/accounts/#{account.id}/upload/",
|
||||
headers: administrator.create_new_auth_token,
|
||||
params: { attachment: file }
|
||||
|
||||
@@ -163,13 +163,13 @@ RSpec.describe 'Api::V1::Accounts::AutomationRulesController', type: :request do
|
||||
file_1 = fixture_file_upload(Rails.root.join('spec/assets/avatar.png'), 'image/png')
|
||||
file_2 = fixture_file_upload(Rails.root.join('spec/assets/sample.png'), 'image/png')
|
||||
|
||||
post '/api/v1/upload',
|
||||
post "/api/v1/accounts/#{account.id}/upload/",
|
||||
headers: administrator.create_new_auth_token,
|
||||
params: { attachment: file_1 }
|
||||
|
||||
blob_1 = response.parsed_body
|
||||
|
||||
post '/api/v1/upload',
|
||||
post "/api/v1/accounts/#{account.id}/upload/",
|
||||
headers: administrator.create_new_auth_token,
|
||||
params: { attachment: file_2 }
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do
|
||||
it 'Saves file in the macros actions to send an attachments' do
|
||||
file = fixture_file_upload(Rails.root.join('spec/assets/avatar.png'), 'image/png')
|
||||
|
||||
post '/api/v1/upload',
|
||||
post "/api/v1/accounts/#{account.id}/upload/",
|
||||
headers: administrator.create_new_auth_token,
|
||||
params: { attachment: file }
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Api::V1::UploadController', type: :request do
|
||||
describe 'POST /api/v1/upload/' do
|
||||
RSpec.describe 'Api::V1::Accounts::UploadController', type: :request do
|
||||
describe 'POST /api/v1/account/1/upload/' do
|
||||
let(:account) { create(:account) }
|
||||
let(:user) { create(:user, account: account) }
|
||||
|
||||
it 'uploads the image when authorized' do
|
||||
file = fixture_file_upload(Rails.root.join('spec/assets/avatar.png'), 'image/png')
|
||||
|
||||
post '/api/v1/upload/',
|
||||
post "/api/v1/accounts/#{account.id}/upload/",
|
||||
headers: user.create_new_auth_token,
|
||||
params: { attachment: file }
|
||||
|
||||
@@ -25,7 +25,7 @@ RSpec.describe 'Api::V1::UploadController', type: :request do
|
||||
it 'does not upload when un-authorized' do
|
||||
file = fixture_file_upload(Rails.root.join('spec/assets/avatar.png'), 'image/png')
|
||||
|
||||
post '/api/v1/upload/',
|
||||
post "/api/v1/accounts/#{account.id}/upload/",
|
||||
headers: {},
|
||||
params: { attachment: file }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user