jmettraux / rufus-verbs

GET, POST, PUT, DELETE, with something around (ruby)

This URL has Read+Write access

rufus-verbs / test / auth0_test.rb
100644 44 lines (31 sloc) 0.84 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#
# Testing rufus-verbs
#
# jmettraux@gmail.com
#
# Sun Jan 13 12:33:03 JST 2008
#
 
require File.dirname(__FILE__) + '/base.rb'
 
 
class Auth0Test < Test::Unit::TestCase
  include TestBaseMixin
 
  include Rufus::Verbs
 
  #
  # Using an items server with the authentication on.
  #
  def setup
 
    @server = ItemServer.new :auth => :basic
    @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