diff options
author | Azul <azul@riseup.net> | 2016-05-18 21:00:42 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2016-05-20 16:35:55 +0200 |
commit | e542a3056c27fd662ef767b6720861035f6dbb1c (patch) | |
tree | 45d0d16069a7820a58583423956c8cc4f5f64819 /test/functional/api/token_auth_test.rb | |
parent | 83f59164fc069f2593cf6babbc18638d9a68c9a3 (diff) |
api: set defaults for version in routes
This way we do not need to specify it all the times.
In the functional tests defaults do not get added automatically.
Introduced api_{get,put,post,delete} to add format and version default.
One to two functional tests failing, everything else passes.
Diffstat (limited to 'test/functional/api/token_auth_test.rb')
-rw-r--r-- | test/functional/api/token_auth_test.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/functional/api/token_auth_test.rb b/test/functional/api/token_auth_test.rb index 17a4775..c7f91c7 100644 --- a/test/functional/api/token_auth_test.rb +++ b/test/functional/api/token_auth_test.rb @@ -5,13 +5,13 @@ require 'test_helper' -class Api::TokenAuthTest < ActionController::TestCase +class Api::TokenAuthTest < ApiControllerTest tests Api::ConfigsController def test_login_via_api_token with_config(:allow_anonymous_certs => false) do monitor_auth do - get :index + api_get :index assert assigns(:token), 'should have authenticated via api token' assert assigns(:token).is_a? ApiToken assert @controller.send(:current_user).is_a? ApiMonitorUser @@ -26,10 +26,10 @@ class Api::TokenAuthTest < ActionController::TestCase with_config(new_config) do monitor_auth do request.env['REMOTE_ADDR'] = "1.1.1.1" - get :index + api_get :index assert_nil assigns(:token), "should not be able to auth with api token when ip restriction doesn't allow it" request.env['REMOTE_ADDR'] = allowed - get :index + api_get :index assert assigns(:token), "should have authenticated via api token" end end |