Sha256: 7df44e8a8bd1035b44c793649691c4e19a2d8a400969bd6b52b3f7170e622d41

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 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 Overrides::TokenValidationsControllerTest < ActionDispatch::IntegrationTest
  describe Overrides::TokenValidationsController do
    before do
      @resource = evil_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)

      get '/evil_user_auth/validate_token',
          params: {},
          headers: @auth_headers

      @resp = JSON.parse(response.body)
    end

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

    test 'controller was overridden' do
      assert_equal Overrides::TokenValidationsController::OVERRIDE_PROOF,
                   @resp['override_proof']
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
devise_token_auth-0.1.43 test/controllers/overrides/token_validations_controller_test.rb
digix_devise_token_auth-0.1.44 test/controllers/overrides/token_validations_controller_test.rb
devise_token_auth-0.1.43.beta1 test/controllers/overrides/token_validations_controller_test.rb