Sha256: ac0d25854f2d18dbe7f20b4c4a6ab6a6bead2df8d13af3068cee9c3eb5defc4a

Contents?: true

Size: 943 Bytes

Versions: 2

Compression:

Stored size: 943 Bytes

Contents

require 'test_helper'

module LetsencryptHttpChallenge
  class ApplicationControllerTest < ActionController::TestCase
    setup do
      @routes = LetsencryptHttpChallenge::Engine.routes
    end

    test "matching challenge token returns the challenge response" do
      get :index, challenge: '58u1GLEGwgSbK-3LnTYUDwZySN3FmTxE4CuqAf8IpAU'
      assert_response :success
      assert_match('58u1GLEGwgSbK-3LnTYUDwZySN3FmTxE4CuqAf8IpAU.VDnmZ7G7W4pPpHL_rTLA9SUPSN0qTwe876q2C2gpLLs', response.body)
    end

    test "token must match" do
      get :index, challenge: '58u1GLEGwgSbK-3LnTYUDwZySN3FmTxE4CuqAf8IpAU_wrong_token'
      assert_response :bad_request
      assert_match('token must match between', response.body)
    end

    test "token must be longer than 128 bits" do
      get :index, challenge: '58u1GLEG'
      assert_response :bad_request
      assert_match('token must have at least 128 bits', response.body)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
letsencrypt_http_challenge-0.0.2 test/controllers/application_controller_test.rb
letsencrypt_http_challenge-0.0.1 test/controllers/application_controller_test.rb