Skip to content

Commit bc2e99a

Browse files
committed
Updating Network Authentication Client tests and implmentation
1 parent 6633c56 commit bc2e99a

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

Gemfile

+3
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ gem 'sorbet', :group => :development
1313
gem 'sorbet-runtime'
1414
gem 'phonelib'
1515
gem 'codecov', :require => false, :group => :test
16+
group :test, :development do
17+
gem 'pry'
18+
end

lib/vonage/network_authentication/client.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def token(oidc_auth_code:, redirect_uri:, **params)
2020
redirect_uri: redirect_uri
2121
},
2222
type: Post
23-
)
23+
).access_token
2424
end
2525

2626
def generate_oidc_uri(purpose:, api_scope:, login_hint:, redirect_uri:, state: nil)

test/vonage/network_authentication/client_test.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ def test_token_method
4141
redirect_uri: example_redirect_uri
4242
}
4343

44-
stub_request(:post, token_uri).with(request(body: request_params, headers: headers)).to_return(response)
44+
stub_request(:post, token_uri).with(request(body: request_params, headers: headers)).to_return(network_authentication_token_response)
4545

46-
assert_kind_of Vonage::Response, client.token(oidc_auth_code: example_oidc_auth_code, redirect_uri: example_redirect_uri)
46+
assert_equal sample_webhook_token, client.token(oidc_auth_code: example_oidc_auth_code, redirect_uri: example_redirect_uri)
4747
end
4848

4949
def test_token_method_without_oidc_auth_code

test/vonage/test.rb

+6
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,12 @@ def meetings_rooms_list_response_multiple
358358
}
359359
end
360360

361+
def network_authentication_token_response
362+
{
363+
body: '{"access_token":"' + sample_webhook_token + '", "token_type":"Bearer", "expires_in":3600}',
364+
headers: response_headers }
365+
end
366+
361367
def response
362368
{ body: '{"key":"value"}', headers: response_headers }
363369
end

0 commit comments

Comments
 (0)