Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/elixir/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 29 additions & 0 deletions test/elixir/test/form_submit_test.exs
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions test/javascript/tests/form_submit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down