analysand 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,40 +0,0 @@
1
- require 'base64'
2
-
3
- shared_examples_for 'a session grantor' do
4
- let(:result) { instance.establish_session(credentials[:username], credentials[:password]) }
5
- let(:role_locator) do
6
- lambda { |resp| resp['roles'] }
7
- end
8
-
9
- before do
10
- @session, @resp = result
11
- end
12
-
13
- it 'returns a session and the original response' do
14
- @session.should_not be_nil
15
- @resp.should_not be_nil
16
- end
17
-
18
- describe 'the session object' do
19
- it 'has the username' do
20
- @session[:username].should == credentials[:username]
21
- end
22
-
23
- it 'has the token issuance time' do
24
- @session[:token] =~ /AuthSession=([^;]+)/
25
-
26
- time_as_hex = Base64.decode64($1).split(':')[1]
27
- issuance_time = time_as_hex.to_i(16)
28
-
29
- @session[:issued_at].should == issuance_time
30
- end
31
-
32
- it 'has the user roles' do
33
- @session[:roles].should == role_locator[@resp.body]
34
- end
35
-
36
- it 'has a session token' do
37
- @session[:token].should =~ /AuthSession.+/
38
- end
39
- end
40
- end
@@ -1,77 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: put
5
- uri: http://admin:admin@localhost:5984/_config/stats/rate
6
- body:
7
- encoding: UTF-8
8
- string: ! '"1200"'
9
- headers:
10
- Accept:
11
- - ! '*/*'
12
- User-Agent:
13
- - Ruby
14
- Connection:
15
- - keep-alive
16
- Keep-Alive:
17
- - 30
18
- response:
19
- status:
20
- code: 200
21
- message: OK
22
- headers:
23
- Server:
24
- - CouchDB/1.2.0 (Erlang OTP/R15B02)
25
- Date:
26
- - Wed, 14 Nov 2012 00:18:14 GMT
27
- Content-Type:
28
- - text/plain; charset=utf-8
29
- Content-Length:
30
- - '7'
31
- Cache-Control:
32
- - must-revalidate
33
- body:
34
- encoding: US-ASCII
35
- string: ! '"1000"
36
-
37
- '
38
- http_version:
39
- recorded_at: Wed, 14 Nov 2012 00:18:14 GMT
40
- - request:
41
- method: get
42
- uri: http://admin:admin@localhost:5984/_config/stats/rate
43
- body:
44
- encoding: US-ASCII
45
- string: ''
46
- headers:
47
- Accept:
48
- - ! '*/*'
49
- User-Agent:
50
- - Ruby
51
- Connection:
52
- - keep-alive
53
- Keep-Alive:
54
- - 30
55
- response:
56
- status:
57
- code: 200
58
- message: OK
59
- headers:
60
- Server:
61
- - CouchDB/1.2.0 (Erlang OTP/R15B02)
62
- Date:
63
- - Wed, 14 Nov 2012 00:18:14 GMT
64
- Content-Type:
65
- - text/plain; charset=utf-8
66
- Content-Length:
67
- - '7'
68
- Cache-Control:
69
- - must-revalidate
70
- body:
71
- encoding: US-ASCII
72
- string: ! '"1200"
73
-
74
- '
75
- http_version:
76
- recorded_at: Wed, 14 Nov 2012 00:18:14 GMT
77
- recorded_with: VCR 2.3.0