summaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorazul <azul@riseup.net>2016-08-19 10:40:37 +0000
committerazul <azul@riseup.net>2016-08-19 10:40:37 +0000
commit67302ca1986a66a6d278c34216ad33f4c65a018e (patch)
treed55e4c4dd3a6612e04e0fd40e736c8b6d4342762 /test/functional
parent44910c0909f28791fe6725fa76301e5111ece3b4 (diff)
parentfbad882075e745ab7afbe5f89c67544fb3c607c3 (diff)
Merge branch 'bugfix/send-406-on-unsupported-format' into 'develop'
Bugfix/send 406 on unsupported format See merge request !5
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/api/certs_controller_test.rb6
-rw-r--r--test/functional/api/sessions_controller_test.rb3
-rw-r--r--test/functional/home_controller_test.rb16
3 files changed, 24 insertions, 1 deletions
diff --git a/test/functional/api/certs_controller_test.rb b/test/functional/api/certs_controller_test.rb
index f23b4c8..25ceb8e 100644
--- a/test/functional/api/certs_controller_test.rb
+++ b/test/functional/api/certs_controller_test.rb
@@ -57,4 +57,10 @@ class Api::CertsControllerTest < ApiControllerTest
returns(cert)
return cert
end
+
+ # overwrite defaults from ApiController because we don't do json here.
+ def add_api_defaults(args)
+ add_defaults args, version: '2'
+ end
+
end
diff --git a/test/functional/api/sessions_controller_test.rb b/test/functional/api/sessions_controller_test.rb
index 03a1ef9..06a3c22 100644
--- a/test/functional/api/sessions_controller_test.rb
+++ b/test/functional/api/sessions_controller_test.rb
@@ -44,7 +44,8 @@ class Api::SessionsControllerTest < ApiControllerTest
api_post :update, :id => @user.login, :client_auth => @client_hex
- assert_nil session[:handshake]
+ assert_nil session[:handshake],
+ 'session should be cleared to prevent session fixation attacks'
assert_response :success
assert json_response.keys.include?("id")
assert json_response.keys.include?("token")
diff --git a/test/functional/home_controller_test.rb b/test/functional/home_controller_test.rb
new file mode 100644
index 0000000..cafaac5
--- /dev/null
+++ b/test/functional/home_controller_test.rb
@@ -0,0 +1,16 @@
+require 'test_helper'
+
+class HomeControllerTest < ActionController::TestCase
+
+ def test_renders_okay
+ get :index
+ assert_response :success
+ end
+
+ def test_other_formats_trigger_406
+ assert_raises ActionController::UnknownFormat do
+ get :index, format: :xml
+ end
+ end
+
+end