2
2
require_relative '../test'
3
3
4
4
class Vonage ::NetworkAuthentication ::ServerAuthenticationTest < Vonage ::Test
5
- def server
5
+ def server_authentication
6
6
Vonage ::NetworkAuthentication ::ServerAuthentication . new ( config )
7
7
end
8
8
@@ -34,22 +34,22 @@ def test_bc_authorize_method
34
34
35
35
stub_request ( :post , bc_authorize_uri ) . with ( request ( body : request_params , headers : headers ) ) . to_return ( network_authentication_oicd_response )
36
36
37
- response = server . bc_authorize ( purpose : example_purpose , api_scope : example_api_scope , login_hint : example_login_hint )
37
+ response = server_authentication . bc_authorize ( purpose : example_purpose , api_scope : example_api_scope , login_hint : example_login_hint )
38
38
39
39
assert_kind_of Vonage ::Response , response
40
40
assert_equal network_authentication_auth_request_id , response . auth_req_id
41
41
end
42
42
43
43
def test_bc_authorize_method_without_purpose
44
- assert_raises ( ArgumentError ) { server . bc_authorize ( api_scope : example_api_scope , login_hint : example_login_hint ) }
44
+ assert_raises ( ArgumentError ) { server_authentication . bc_authorize ( api_scope : example_api_scope , login_hint : example_login_hint ) }
45
45
end
46
46
47
47
def test_bc_authorize_method_without_api_scope
48
- assert_raises ( ArgumentError ) { server . bc_authorize ( purpose : example_purpose , login_hint : example_login_hint ) }
48
+ assert_raises ( ArgumentError ) { server_authentication . bc_authorize ( purpose : example_purpose , login_hint : example_login_hint ) }
49
49
end
50
50
51
51
def test_bc_authorize_method_without_login_hint
52
- assert_raises ( ArgumentError ) { server . bc_authorize ( purpose : example_purpose , api_scope : example_api_scope ) }
52
+ assert_raises ( ArgumentError ) { server_authentication . bc_authorize ( purpose : example_purpose , api_scope : example_api_scope ) }
53
53
end
54
54
55
55
def test_request_access_token_method
@@ -60,14 +60,14 @@ def test_request_access_token_method
60
60
61
61
stub_request ( :post , token_uri ) . with ( request ( body : request_params , headers : headers ) ) . to_return ( network_authentication_token_response )
62
62
63
- response = server . request_access_token ( auth_req_id : network_authentication_auth_request_id )
63
+ response = server_authentication . request_access_token ( auth_req_id : network_authentication_auth_request_id )
64
64
65
65
assert_kind_of Vonage ::Response , response
66
66
assert_equal sample_webhook_token , response . access_token
67
67
end
68
68
69
69
def test_request_access_token_method_without_auth_req_id
70
- assert_raises ( ArgumentError ) { server . request_access_token }
70
+ assert_raises ( ArgumentError ) { server_authentication . request_access_token }
71
71
end
72
72
73
73
def test_token_method
@@ -84,18 +84,18 @@ def test_token_method
84
84
stub_request ( :post , bc_authorize_uri ) . with ( request ( body : bc_authorize_request_params , headers : headers ) ) . to_return ( network_authentication_oicd_response )
85
85
stub_request ( :post , token_uri ) . with ( request ( body : request_access_token_request_params , headers : headers ) ) . to_return ( network_authentication_token_response )
86
86
87
- assert_equal sample_webhook_token , server . token ( purpose : example_purpose , api_scope : example_api_scope , login_hint : example_login_hint )
87
+ assert_equal sample_webhook_token , server_authentication . token ( purpose : example_purpose , api_scope : example_api_scope , login_hint : example_login_hint )
88
88
end
89
89
90
90
def test_token_method_without_purpose
91
- assert_raises ( ArgumentError ) { server . token ( api_scope : example_api_scope , login_hint : example_login_hint ) }
91
+ assert_raises ( ArgumentError ) { server_authentication . token ( api_scope : example_api_scope , login_hint : example_login_hint ) }
92
92
end
93
93
94
94
def test_token_method_without_api_scope
95
- assert_raises ( ArgumentError ) { server . token ( purpose : example_purpose , login_hint : example_login_hint ) }
95
+ assert_raises ( ArgumentError ) { server_authentication . token ( purpose : example_purpose , login_hint : example_login_hint ) }
96
96
end
97
97
98
98
def test_token_method_without_login_hint
99
- assert_raises ( ArgumentError ) { server . token ( purpose : example_purpose , api_scope : example_api_scope ) }
99
+ assert_raises ( ArgumentError ) { server_authentication . token ( purpose : example_purpose , api_scope : example_api_scope ) }
100
100
end
101
101
end
0 commit comments