FIX: Allow api to send uploads with :url

This commit is contained in:
Konstantin Ilchenko
2015-06-21 14:52:52 +03:00
parent ca42d00883
commit 131cf643ce
2 changed files with 18 additions and 2 deletions

View File

@ -53,6 +53,22 @@ describe UploadsController do
expect(message.data).to be
end
it 'is successful with synchronous api' do
SiteSetting.stubs(:authorized_extensions).returns("*")
controller.stubs(:is_api?).returns(true)
Jobs.expects(:enqueue).with(:create_thumbnails, anything)
FakeWeb.register_uri(:get, "http://example.com/image.png", :body => File.read('spec/fixtures/images/logo.png'))
xhr :post, :create, url: 'http://example.com/image.png', type: "avatar", synchronous: true
json = ::JSON.parse(response.body)
expect(response.status).to eq 200
expect(json["id"]).to be
end
it 'correctly sets retain_hours for admins' do
Jobs.expects(:enqueue).with(:create_thumbnails, anything)