From a7718c19ab96648e37063c05bffe21bc2c315325 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 3 May 2016 09:01:18 -0300 Subject: fix type mismatch TokenAuthTest rails 4 mixes model, controller and integration tests. So lets give this one a better name --- test/functional/token_auth_test.rb | 40 -------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 test/functional/token_auth_test.rb (limited to 'test/functional/token_auth_test.rb') diff --git a/test/functional/token_auth_test.rb b/test/functional/token_auth_test.rb deleted file mode 100644 index 53d5fb3..0000000 --- a/test/functional/token_auth_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -# -# tests for authenticating an admin or monitor user -# via static configured tokens. -# - -require_relative '../test_helper' - -class TokenAuthTest < ActionController::TestCase - tests V1::ConfigsController - - def test_login_via_api_token - with_config(:allow_anonymous_certs => false) do - monitor_auth do - 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 - end - end - end - - def test_fail_api_auth_when_ip_not_allowed - with_config(:allow_anonymous_certs => false) do - allowed = "99.99.99.99" - new_config = {api_tokens: APP_CONFIG["api_tokens"].merge(allowed_ips: [allowed])} - with_config(new_config) do - monitor_auth do - request.env['REMOTE_ADDR'] = "1.1.1.1" - 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 - assert assigns(:token), "should have authenticated via api token" - end - end - end - end - -end - -- cgit v1.2.3