request_builder_test: mode :read got removed
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Mon, 31 May 2021 08:14:12 +0000 (10:14 +0200)
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Thu, 3 Jun 2021 17:11:17 +0000 (19:11 +0200)
test/pleroma/http/request_builder_test.exs

index e9b0c4a8a25c4c004cc293a05efe0238330e7bd1..433beaac113f3e7c3fd87eba42f4931ec1cfa9b3 100644 (file)
@@ -34,24 +34,32 @@ defmodule Pleroma.HTTP.RequestBuilderTest do
 
   describe "add_param/4" do
     test "add file parameter" do
-      %Request{
-        body: %Tesla.Multipart{
-          boundary: _,
-          content_type_params: [],
-          parts: [
-            %Tesla.Multipart.Part{
-              body: %File.Stream{
-                line_or_bytes: 2048,
-                modes: [:raw, :read_ahead, :read, :binary],
-                path: "some-path/filename.png",
-                raw: true
-              },
-              dispositions: [name: "filename.png", filename: "filename.png"],
-              headers: []
-            }
-          ]
-        }
-      } = RequestBuilder.add_param(%Request{}, :file, "filename.png", "some-path/filename.png")
+      assert match?(
+               %Request{
+                 body: %Tesla.Multipart{
+                   boundary: _,
+                   content_type_params: [],
+                   parts: [
+                     %Tesla.Multipart.Part{
+                       body: %File.Stream{
+                         line_or_bytes: 2048,
+                         modes: [:raw, :read_ahead, :binary],
+                         path: "some-path/filename.png",
+                         raw: true
+                       },
+                       dispositions: [name: "filename.png", filename: "filename.png"],
+                       headers: []
+                     }
+                   ]
+                 }
+               },
+               RequestBuilder.add_param(
+                 %Request{},
+                 :file,
+                 "filename.png",
+                 "some-path/filename.png"
+               )
+             )
     end
 
     test "add key to body" do