aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/web/activity_pub/activity_pub_test.exs11
-rw-r--r--test/web/twitter_api/twitter_api_test.exs8
2 files changed, 18 insertions, 1 deletions
diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs
index b773c323e..0e778d887 100644
--- a/test/web/activity_pub/activity_pub_test.exs
+++ b/test/web/activity_pub/activity_pub_test.exs
@@ -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
diff --git a/test/web/twitter_api/twitter_api_test.exs b/test/web/twitter_api/twitter_api_test.exs
index 5325110e1..dcffab2b8 100644
--- a/test/web/twitter_api/twitter_api_test.exs
+++ b/test/web/twitter_api/twitter_api_test.exs
@@ -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