Sha256: 23cbc6b033e2334adfdefd112d44ca4748a77e95ced6ca2c9c01aa33300e7408

Contents?: true

Size: 900 Bytes

Versions: 8

Compression:

Stored size: 900 Bytes

Contents

require "test/setup"

class AdminUiTest < Test::Unit::TestCase
  context "/" do
    setup { get "/oauth/admin" }
    should "return OK" do
      assert_equal 200, last_response.status
    end
    should "return HTML page" do
      assert_match "<html>", last_response.body
    end
  end

  context "force SSL" do
    setup { Server::Admin.force_ssl = true }

    context "HTTP request" do
      setup { get "/oauth/admin" }

      should "redirect to HTTPS" do
        assert_equal 302, last_response.status
        assert_match "https://example.org/oauth/admin", last_response.location
      end
    end

    context "HTTPS request" do
      setup { get "https://example.org/oauth/admin" }

      should "serve request" do
        assert_equal 200, last_response.status
        assert_match "<html>", last_response.body
      end
    end

    teardown { Server::Admin.force_ssl = false }
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rack-oauth2-server-2.8.1 test/admin/ui_test.rb
rack-oauth2-server-2.8.0 test/admin/ui_test.rb
rack-oauth2-server-2.7.0 test/admin/ui_test.rb
rack-oauth2-server-2.6.1 test/admin/ui_test.rb
rack-oauth2-server-2.6.0 test/admin/ui_test.rb
rack-oauth2-server-2.5.1 test/admin/ui_test.rb
rack-oauth2-server-2.5.0 test/admin/ui_test.rb
rack-oauth2-server-2.4.2 test/admin/ui_test.rb