diff options
author | Alessio Biancalana <dottorblaster@gmail.com> | 2020-02-27 20:33:01 +0100 |
---|---|---|
committer | Alessio Biancalana <dottorblaster@gmail.com> | 2020-02-27 22:38:36 +0100 |
commit | d163648521f74f5b9d3085e8eab68b8339c4fc2a (patch) | |
tree | 65dd7bb40533e2d65d534d7734f9a69ee0141719 | |
parent | 7a33ca09e15b3a995afab373dbc9162ec9272d4a (diff) | |
download | couchdb-d163648521f74f5b9d3085e8eab68b8339c4fc2a.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 |