Skip to content

Commit 1589ff3

Browse files
committed
Updating tests in line with OIDC URI fix
1 parent b69040f commit 1589ff3

8 files changed

+13
-13
lines changed

lib/vonage/client.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def network_number_verification
9898
@network_number_verification ||= T.let(NetworkNumberVerification.new(config), T.nilable(Vonage::NetworkNumberVerification))
9999
end
100100

101-
# @return [NetworkNumberVerification]
101+
# @return [NetworkSIMSwap]
102102
#
103103
sig { returns(T.nilable(Vonage::NetworkSIMSwap)) }
104104
def network_sim_swap

lib/vonage/network_authentication/client_authentication.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def token(oidc_auth_code:, redirect_uri:, **params)
2424
end
2525

2626
def generate_oidc_uri(purpose:, api_scope:, login_hint:, redirect_uri:, state: nil)
27-
scope = "openid+dpv:#{purpose}##{api_scope}"
27+
scope = "openid%20dpv:#{purpose}%23#{api_scope}"
2828
uri = "https://oidc.idp.vonage.com/oauth2/auth?" +
2929
"client_id=#{@config.application_id}" +
3030
"&response_type=code" +

lib/vonage/network_authentication/server_authentication.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def token(purpose:, api_scope:, login_hint:, **params)
2222
end
2323

2424
def bc_authorize(purpose:, api_scope:, login_hint:)
25-
scope = "openid+dpv:#{purpose}##{api_scope}"
25+
scope = "openid dpv:#{purpose}##{api_scope}"
2626
request(
2727
"/oauth2/bc-authorize",
2828
params: {

lib/vonage/network_number_verification.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def verify(phone_number:, auth_data:, hashed: false)
7373
#
7474
# @param [required, String] :redirect_uri The URI that will receive the callback containing the OIDC auth code.
7575
#
76-
# @param [optional, String] :state A string that you can use for tracking.
76+
# @param [required, String] :state A string that you can use for tracking.
7777
# This field is optional, but it is recommended to set a unique identifier for each access token you generate.
7878
#
7979
# @return [String]

test/vonage/network_authentication/client_authentication_test.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_generate_oidc_uri_method
5858
redirect_uri: example_redirect_uri
5959
)
6060

61-
assert_equal "https://oidc.idp.vonage.com/oauth2/auth?client_id=#{application_id}&response_type=code&scope=openid+dpv:#{example_purpose}##{example_api_scope}&login_hint=#{example_login_hint}&redirect_uri=#{example_redirect_uri}", uri
61+
assert_equal "https://oidc.idp.vonage.com/oauth2/auth?client_id=#{application_id}&response_type=code&scope=openid%20dpv:#{example_purpose}%23#{example_api_scope}&login_hint=#{example_login_hint}&redirect_uri=#{example_redirect_uri}", uri
6262
end
6363

6464
def test_generate_oidc_uri_method_with_optional_params
@@ -70,7 +70,7 @@ def test_generate_oidc_uri_method_with_optional_params
7070
state: '12345'
7171
)
7272

73-
assert_equal "https://oidc.idp.vonage.com/oauth2/auth?client_id=#{application_id}&response_type=code&scope=openid+dpv:#{example_purpose}##{example_api_scope}&login_hint=#{example_login_hint}&redirect_uri=#{example_redirect_uri}&state=12345", uri
73+
assert_equal "https://oidc.idp.vonage.com/oauth2/auth?client_id=#{application_id}&response_type=code&scope=openid%20dpv:#{example_purpose}%23#{example_api_scope}&login_hint=#{example_login_hint}&redirect_uri=#{example_redirect_uri}&state=12345", uri
7474
end
7575

7676
def test_generate_oidc_uri_method_without_purpose

test/vonage/network_authentication/server_authentication_test.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def example_login_hint
2828

2929
def test_bc_authorize_method
3030
request_params = {
31-
scope: "openid+dpv:#{example_purpose}##{example_api_scope}",
31+
scope: "openid dpv:#{example_purpose}##{example_api_scope}",
3232
login_hint: example_login_hint
3333
}
3434

@@ -72,7 +72,7 @@ def test_request_access_token_method_without_auth_req_id
7272

7373
def test_token_method
7474
bc_authorize_request_params = {
75-
scope: "openid+dpv:#{example_purpose}##{example_api_scope}",
75+
scope: "openid dpv:#{example_purpose}##{example_api_scope}",
7676
login_hint: example_login_hint
7777
}
7878

test/vonage/network_number_verification_test.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,13 @@ def test_check_method_with_invalid_redirect_uri
152152
end
153153

154154
def test_generate_client_uri_method
155-
expected_uri = "https://oidc.idp.vonage.com/oauth2/auth?client_id=#{application_id}&response_type=code&scope=openid+dpv:FraudPreventionAndDetection#number-verification-verify-read&login_hint=#{phone_number}&redirect_uri=#{example_redirect_uri}"
155+
expected_uri = "https://oidc.idp.vonage.com/oauth2/auth?client_id=#{application_id}&response_type=code&scope=openid%20dpv:FraudPreventionAndDetection%23number-verification-verify-read&login_hint=#{phone_number}&redirect_uri=#{example_redirect_uri}"
156156

157157
assert_equal expected_uri, network_number_verification.generate_oidc_uri(phone_number: phone_number, redirect_uri: example_redirect_uri)
158158
end
159159

160160
def test_generate_client_uri_method_with_optional_params
161-
expected_uri = "https://oidc.idp.vonage.com/oauth2/auth?client_id=#{application_id}&response_type=code&scope=openid+dpv:FraudPreventionAndDetection#number-verification-verify-read&login_hint=#{phone_number}&redirect_uri=#{example_redirect_uri}&state=12345"
161+
expected_uri = "https://oidc.idp.vonage.com/oauth2/auth?client_id=#{application_id}&response_type=code&scope=openid%20dpv:FraudPreventionAndDetection%23number-verification-verify-read&login_hint=#{phone_number}&redirect_uri=#{example_redirect_uri}&state=12345"
162162

163163
assert_equal expected_uri, network_number_verification.generate_oidc_uri(phone_number: phone_number, redirect_uri: example_redirect_uri, state: '12345')
164164
end

test/vonage/network_sim_swap_test.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def phone_number
1616

1717
def test_check_method
1818
bc_authorize_request_params = {
19-
scope: "openid+dpv:FraudPreventionAndDetection#check-sim-swap",
19+
scope: "openid dpv:FraudPreventionAndDetection#check-sim-swap",
2020
login_hint: phone_number
2121
}
2222

@@ -36,7 +36,7 @@ def test_check_method
3636

3737
def test_check_method_with_optional_params
3838
bc_authorize_request_params = {
39-
scope: "openid+dpv:FraudPreventionAndDetection#check-sim-swap",
39+
scope: "openid dpv:FraudPreventionAndDetection#check-sim-swap",
4040
login_hint: phone_number
4141
}
4242

@@ -71,7 +71,7 @@ def test_check_method_with_invalid_max_age
7171

7272
def test_retrieve_date_method
7373
bc_authorize_request_params = {
74-
scope: "openid+dpv:FraudPreventionAndDetection#retrieve-sim-swap-date",
74+
scope: "openid dpv:FraudPreventionAndDetection#retrieve-sim-swap-date",
7575
login_hint: phone_number
7676
}
7777

0 commit comments

Comments
 (0)