Basic file uploading via TwAPI.
This commit is contained in:
parent
08fdbd6f3a
commit
e7dc39e40c
10 changed files with 57 additions and 6 deletions
|
|
@ -1,7 +1,7 @@
|
|||
defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
|
||||
use Pleroma.DataCase
|
||||
alias Pleroma.Web.ActivityPub.ActivityPub
|
||||
alias Pleroma.Activity
|
||||
alias Pleroma.{Activity, Object}
|
||||
alias Pleroma.Builders.ActivityBuilder
|
||||
|
||||
describe "insertion" do
|
||||
|
|
@ -94,4 +94,13 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
|
|||
assert last == last_expected
|
||||
end
|
||||
end
|
||||
|
||||
describe "uploading files" do
|
||||
test "copies the file to the configured folder" do
|
||||
file = %Plug.Upload{content_type: "image/jpg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg"}
|
||||
|
||||
{:ok, %Object{} = object} = ActivityPub.upload(file)
|
||||
assert object.data["name"] == "an_image.jpg"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -116,4 +116,12 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
|
|||
assert Enum.at(statuses, 0)["id"] == activity.id
|
||||
assert Enum.at(statuses, 1)["id"] == activity_two.id
|
||||
end
|
||||
|
||||
test "upload a file" do
|
||||
file = %Plug.Upload{content_type: "image/jpg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg"}
|
||||
|
||||
response = TwitterAPI.upload(file)
|
||||
|
||||
assert is_binary(response)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue