diff options
author | Sergey Suprunenko <suprunenko.s@gmail.com> | 2019-07-15 19:47:23 +0000 |
---|---|---|
committer | kaniini <ariadne@dereferenced.org> | 2019-07-15 19:47:23 +0000 |
commit | b74300bc7a02912489033ea23ccaf876881ef650 (patch) | |
tree | cc1af678f1fe1bbbd7feaf5aad592cb96a28286b /test/web/common_api/common_api_utils_test.exs | |
parent | 30d7e22784eaeb36099bd9e7a197b8a9676b6123 (diff) | |
download | pleroma-b74300bc7a02912489033ea23ccaf876881ef650.tar.gz pleroma-b74300bc7a02912489033ea23ccaf876881ef650.zip |
Add more tests for MastodonAPIController and CommonAPI
Diffstat (limited to 'test/web/common_api/common_api_utils_test.exs')
-rw-r--r-- | test/web/common_api/common_api_utils_test.exs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/test/web/common_api/common_api_utils_test.exs b/test/web/common_api/common_api_utils_test.exs index b3a334d50..af320f31f 100644 --- a/test/web/common_api/common_api_utils_test.exs +++ b/test/web/common_api/common_api_utils_test.exs @@ -10,6 +10,7 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do alias Pleroma.Web.Endpoint use Pleroma.DataCase + import ExUnit.CaptureLog import Pleroma.Factory @public_address "https://www.w3.org/ns/activitystreams#Public" @@ -202,7 +203,9 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do expected = "" - assert Utils.date_to_asctime(date) == expected + assert capture_log(fn -> + assert Utils.date_to_asctime(date) == expected + end) =~ "[warn] Date #{date} in wrong format, must be ISO 8601" end test "when date is a Unix timestamp" do @@ -210,13 +213,23 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do expected = "" - assert Utils.date_to_asctime(date) == expected + assert capture_log(fn -> + assert Utils.date_to_asctime(date) == expected + end) =~ "[warn] Date #{date} in wrong format, must be ISO 8601" end test "when date is nil" do expected = "" - assert Utils.date_to_asctime(nil) == expected + assert capture_log(fn -> + assert Utils.date_to_asctime(nil) == expected + end) =~ "[warn] Date in wrong format, must be ISO 8601" + end + + test "when date is a random string" do + assert capture_log(fn -> + assert Utils.date_to_asctime("foo") == "" + end) =~ "[warn] Date foo in wrong format, must be ISO 8601" end end |