diff options
author | Alessio Biancalana <dottorblaster@gmail.com> | 2020-02-27 20:33:01 +0100 |
---|---|---|
committer | Alessio Biancalana <dottorblaster@gmail.com> | 2020-03-02 08:40:37 +0100 |
commit | a21f25f7de32a50f8b3a55b4b3f80001504622c5 (patch) | |
tree | 3d049035692e24eff1fd109b89f0b53db4bfe523 | |
parent | fc16ab24a77f1732f0b51ba3c226fc6eced0a71e (diff) | |
download | couchdb-a21f25f7de32a50f8b3a55b4b3f80001504622c5.tar.gz |
Port form_submit.js test to Elixir
-rw-r--r-- | test/elixir/test/form_submit_test.exs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/elixir/test/form_submit_test.exs b/test/elixir/test/form_submit_test.exs new file mode 100644 index 000000000..1baf947ac --- /dev/null +++ b/test/elixir/test/form_submit_test.exs @@ -0,0 +1,29 @@ +defmodule FormSubmitTest do + use CouchTestCase + + @moduletag :form_submit + + @moduledoc """ + Test that form submission is invalid + This is a port of form_submit.js + """ + + @tag :with_db + test "form submission gives back invalid content-type", context do + headers = [ + Referer: "http://127.0.0.1:15984", + "Content-Type": "application/x-www-form-urlencoded" + ] + + body = %{} + + %{:body => response_body, :status_code => status_code} = + Couch.post("/#{context[:db_name]}/baz", headers: headers, body: body) + + %{"error" => error, "reason" => reason} = response_body + + assert status_code == 415 + assert error == "bad_content_type" + assert reason == "Content-Type must be multipart/form-data" + end +end |