Sha256: 52929b00c9b7a8bf9a98df8026479c16ce5076febcd2f1fd4301e27096d03c7e

Contents?: true

Size: 1.3 KB

Versions: 17

Compression:

Stored size: 1.3 KB

Contents

require 'test_helper'

#  was the web request successful?
#  was the user redirected to the right page?
#  was the user successfully authenticated?
#  was the correct object stored in the response?
#  was the appropriate message delivered in the json payload?

class DeviseTokenAuth::TokenValidationsControllerTest < ActionDispatch::IntegrationTest
  describe DeviseTokenAuth::TokenValidationsController do
    before do
      @resource = users(:confirmed_email_user)
      @resource.skip_confirmation!
      @resource.save!

      @auth_headers = @resource.create_new_auth_token

      @token     = @auth_headers['access-token']
      @client_id = @auth_headers['client']
      @expiry    = @auth_headers['expiry']

      # ensure that request is not treated as batch request
      age_token(@resource, @client_id)

    end

    describe 'vanilla user' do
      before do
        get '/auth/validate_token', {}, @auth_headers
        @resp = JSON.parse(response.body)
      end

      test "token valid" do
        assert_equal 200, response.status
      end
    end

    describe 'using namespaces' do
      before do
        get '/api/v1/auth/validate_token', {}, @auth_headers
        @resp = JSON.parse(response.body)
      end

      test "token valid" do
        assert_equal 200, response.status
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
devise_token_auth-0.1.32.beta10 test/controllers/devise_token_auth/token_validations_controller_test.rb
devise_token_auth-0.1.32.beta9 test/controllers/devise_token_auth/token_validations_controller_test.rb
devise_token_auth-0.1.32.beta8 test/controllers/devise_token_auth/token_validations_controller_test.rb
devise_token_auth-0.1.32.beta7 test/controllers/devise_token_auth/token_validations_controller_test.rb
devise_token_auth-0.1.32.beta6 test/controllers/devise_token_auth/token_validations_controller_test.rb
devise_token_auth-0.1.32.beta5 test/controllers/devise_token_auth/token_validations_controller_test.rb
devise_token_auth-0.1.32.beta4 test/controllers/devise_token_auth/token_validations_controller_test.rb
devise_token_auth-0.1.32.beta3 test/controllers/devise_token_auth/token_validations_controller_test.rb
devise_token_auth-0.1.32.beta2 test/controllers/devise_token_auth/token_validations_controller_test.rb
devise_token_auth-0.1.32.beta1 test/controllers/devise_token_auth/token_validations_controller_test.rb
devise_token_auth-0.1.31 test/controllers/devise_token_auth/token_validations_controller_test.rb
devise_token_auth-0.1.31.beta10 test/controllers/devise_token_auth/token_validations_controller_test.rb
devise_token_auth-0.1.31.beta9 test/controllers/devise_token_auth/token_validations_controller_test.rb
devise_token_auth-0.1.31.beta8 test/controllers/devise_token_auth/token_validations_controller_test.rb
devise_token_auth-0.1.31.beta7 test/controllers/devise_token_auth/token_validations_controller_test.rb
devise_token_auth-0.1.31.beta6 test/controllers/devise_token_auth/token_validations_controller_test.rb
devise_token_auth-0.1.31.beta5 test/controllers/devise_token_auth/token_validations_controller_test.rb