Sha256: 800dd8378879f07785d27f0612e2a801acf4a1a409958e90eee548cfef23c7be

Contents?: true

Size: 579 Bytes

Versions: 1

Compression:

Stored size: 579 Bytes

Contents

require 'test_helper.rb'

# Test HMAC Authorization Method
class HMACFailRunTest < MiniTest::Unit::TestCase
  include Rack::Test::Methods

  def setup
    @secret = 'test_secret'
    @signature = 'test_signature'
  end

  def app
    Rack::SimpleAuth::HMAC.failrunapp
  end

  def test_fail
    uri = '/'
    content = { 'method' => 'GET', 'data' => uri }.to_json
    hash = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), @secret, content)

    assert_raises(NoMethodError) { get uri, {}, 'HTTP_AUTHORIZATION' => "#{hash}:#{@signature}" }
  end

  def teardown
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rack-simple_auth-1.0.0rc test/rack/simple_auth/hmac/hmac_fail_run_test.rb