diff options
author | Alessio Biancalana <dottorblaster@gmail.com> | 2020-03-02 09:04:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-02 09:04:31 +0100 |
commit | d2f2c0d0b502f32c90f670c7dfde398fb972f3d0 (patch) | |
tree | c55a43ec9ceeb63175768fa1b40a9c89f51df1a8 | |
parent | fc16ab24a77f1732f0b51ba3c226fc6eced0a71e (diff) | |
parent | 5fe299946e087ef8b3e1a20d16d80e7932ca2494 (diff) | |
download | couchdb-d2f2c0d0b502f32c90f670c7dfde398fb972f3d0.tar.gz |
Merge pull request #2616 from dottorblaster/port_form_submit_test_to_elixir_30x
Port form submit test to elixir in 3.0.x
-rw-r--r-- | test/elixir/README.md | 2 | ||||
-rw-r--r-- | test/elixir/test/form_submit_test.exs | 29 | ||||
-rw-r--r-- | test/javascript/tests/form_submit.js | 2 |
3 files changed, 32 insertions, 1 deletions
diff --git a/test/elixir/README.md b/test/elixir/README.md index 90b2fd601..5aa70bb9b 100644 --- a/test/elixir/README.md +++ b/test/elixir/README.md @@ -48,7 +48,7 @@ X means done, - means partially - [X] Port erlang_views.js - [X] Port etags_head.js - [ ] ~~Port etags_views.js~~ (skipped in js test suite) - - [ ] Port form_submit.js + - [X] Port form_submit.js - [ ] Port http.js - [X] Port invalid_docids.js - [ ] Port jsonp.js 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 diff --git a/test/javascript/tests/form_submit.js b/test/javascript/tests/form_submit.js index 356182e8d..617686543 100644 --- a/test/javascript/tests/form_submit.js +++ b/test/javascript/tests/form_submit.js @@ -12,6 +12,8 @@ // Do some basic tests. couchTests.form_submit = function(debug) { + return console.log('done in test/elixir/test/form_summit_test.exs'); + var db_name = get_random_db_name(); var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"}); db.createDb(); |