blob: 1baf947acf10e66352a2049c98afdb0d83e351af (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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
|