Sha256: cc07efa7e749b23ac870c70feaa591cc3d55ce56095d163df151ab7641c336fe

Contents?: true

Size: 931 Bytes

Versions: 2

Compression:

Stored size: 931 Bytes

Contents

#
# Testing rufus-verbs
#
# jmettraux@gmail.com
#
# Sun Jan 13 12:33:03 JST 2008
#

require 'test/unit'
require 'testbase'

require 'rufus/verbs'


class AuthTest < Test::Unit::TestCase
    include TestBaseMixin

    include Rufus::Verbs

    #
    # Using an items server with the authentication on.
    #
    def setup

        @server = ItemServer.new :auth => true
        @server.start
    end


    def test_0

        #res = get :uri => "http://localhost:7777/items"
        #assert_equal 200, res.code.to_i
        #assert_equal "{}", res.body.strip
        expect 401, nil, get(:uri => "http://localhost:7777/items")

        expect 401, nil, get(
            :uri => "http://localhost:7777/items", 
            :http_basic_authentication => [ "toto", "wrong" ])

        expect 200, {}, get(
            :uri => "http://localhost:7777/items?a", 
            :http_basic_authentication => [ "toto", "toto" ])
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rufus-verbs-0.2 test/auth_test.rb
rufus-verbs-0.1 test/auth_test.rb