diff options
author | Maxim Filippov <colixer@gmail.com> | 2019-08-14 22:45:32 +0000 |
---|---|---|
committer | Maxim Filippov <colixer@gmail.com> | 2019-08-14 22:45:32 +0000 |
commit | ec969eec5149c5fe2a3e676ea07384b4597487f1 (patch) | |
tree | b725022b93c7f354116e50d54009e0dc5dc19eaf /test/uploaders/local_test.exs | |
parent | b27fafe161241c954b713281bebd6ffe1e990884 (diff) | |
parent | 27b747546a7796de57e88f454b2c2810c7523f97 (diff) | |
download | pleroma-ec969eec5149c5fe2a3e676ea07384b4597487f1.tar.gz pleroma-ec969eec5149c5fe2a3e676ea07384b4597487f1.zip |
Merge branch 'develop' into 'fix/admin-api-user-deletion'
# Conflicts:
# CHANGELOG.md
Diffstat (limited to 'test/uploaders/local_test.exs')
-rw-r--r-- | test/uploaders/local_test.exs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/uploaders/local_test.exs b/test/uploaders/local_test.exs new file mode 100644 index 000000000..fc442d0f1 --- /dev/null +++ b/test/uploaders/local_test.exs @@ -0,0 +1,32 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Uploaders.LocalTest do + use Pleroma.DataCase + alias Pleroma.Uploaders.Local + + describe "get_file/1" do + test "it returns path to local folder for files" do + assert Local.get_file("") == {:ok, {:static_dir, "test/uploads"}} + end + end + + describe "put_file/1" do + test "put file to local folder" do + file_path = "local_upload/files/image.jpg" + + file = %Pleroma.Upload{ + name: "image.jpg", + content_type: "image/jpg", + path: file_path, + tempfile: Path.absname("test/fixtures/image_tmp.jpg") + } + + assert Local.put_file(file) == :ok + + assert Path.join([Local.upload_path(), file_path]) + |> File.exists?() + end + end +end |