summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessio Biancalana <dottorblaster@gmail.com>2020-03-02 08:38:30 +0100
committerGitHub <noreply@github.com>2020-03-02 08:38:30 +0100
commit6995862f909470763c71853ba312c7b6caa0905a (patch)
tree0fcd76c74eea0dfc6c9738c4312551065fd68391
parentc8ade10f949409d0fc555c379a7eeb3ab6b24583 (diff)
parent84ecfb3cb32483a6b4884a4118282b5b5eb661be (diff)
downloadcouchdb-6995862f909470763c71853ba312c7b6caa0905a.tar.gz
Merge pull request #2615 from dottorblaster/port_form_submit_test_to_elixir_3x
Port form submit test to elixir in 3.x branch
-rw-r--r--test/elixir/README.md2
-rw-r--r--test/elixir/test/form_submit_test.exs29
-rw-r--r--test/javascript/tests/form_submit.js2
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();