diff options
author | Alessio Biancalana <dottorblaster@gmail.com> | 2020-02-27 20:33:01 +0100 |
---|---|---|
committer | Alessio Biancalana <dottorblaster@gmail.com> | 2020-02-28 21:22:52 +0100 |
commit | 37d8728e16e90a5fc565bcf22f69af737d4f26ef (patch) | |
tree | 4b8e1e4920f79cfd9ef576b4ec7962340707c36d | |
parent | c8ade10f949409d0fc555c379a7eeb3ab6b24583 (diff) | |
download | couchdb-37d8728e16e90a5fc565bcf22f69af737d4f26ef.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 |