Skip to content

test: core authlete flows#16

Open
shaikathaque wants to merge 19 commits intomainfrom
test-flows
Open

test: core authlete flows#16
shaikathaque wants to merge 19 commits intomainfrom
test-flows

Conversation

@shaikathaque
Copy link
Member

@shaikathaque shaikathaque commented Mar 16, 2026

Context / Summary

This PR adds tests for core Authlete 3.0 flows using the Ruby SDK

Description / Changes Made

The initial flows covered are:

  • Authorization Grant
  • Dpop
  • PAR
  • PKCE
  • Refresh Token
  • OpenID - authorization grant, dpop, par, pkce

Minitest is used because it is the default test framework used by Speakeasy

Testing instructions

These tests can be run against any authlete 3.0 environment with a valid service. The tests run sequentially and modifies a single service for each test.

Run a single file

API_BASE_URL="<authlete-api-server-url>" \
  SERVICE_ID="<service-id>" \
  SERVICE_TOKEN="<service-access-token>" \
  ORG_TOKEN="<org-access-token>" \
  bundle exec ruby -Itest test/auth_grant_test.rb

Run all tests:

API_BASE_URL="<authlete-api-server-url>" \
  SERVICE_ID="<service-id>" \
  SERVICE_TOKEN="<service-access-token>" \
  ORG_TOKEN="<org-access-token>" \
  bundle exec rake test

As of writing, the refresh token flow is failing, and there is an open MR to update the specs to fix this.

API_BASE_URL="<authlete-api-server-url>" \
    SERVICE_ID="<service-id>" \
    SERVICE_TOKEN="<service-access-token>" \
    ORG_TOKEN="<org-access-token>" \
    bundle exec ruby -Itest test/refresh_token_test.rb -v

# Running:

RefreshTokenNotSupportedTest#test_refresh_token_rejected = 3.19 s = .
RefreshTokenNotSupportedTest#test_refresh_token_not_issued = 2.91 s = .
RefreshTokenFlowTest#test_refresh_token_flow = 3.12 s = E
RefreshTokenFlowTest#test_refresh_token_issued = 2.27 s = .
RefreshTokenFlowTest#test_refresh_token_revocation = 2.67 s = .

Finished in 14.174445s, 0.3527 runs/s, 1.4110 assertions/s.

  1) Error:
RefreshTokenFlowTest#test_refresh_token_flow:
NoMethodError: undefined method '[]' for nil
    lib/crystalline/metadata_fields.rb:72:in 'block in Crystalline::MetadataFields::ClassMethods#from_dict'
    lib/crystalline/metadata_fields.rb:68:in 'Array#each'
    lib/crystalline/metadata_fields.rb:68:in 'Crystalline::MetadataFields::ClassMethods#from_dict'
    lib/crystalline/metadata_fields.rb:41:in 'Crystalline::MetadataFields::ClassMethods#unmarshal_single'
    lib/crystalline/metadata_fields.rb:91:in 'block (2 levels) in Crystalline::MetadataFields::ClassMethods#from_dict'
    lib/crystalline/metadata_fields.rb:91:in 'Array#map'
    lib/crystalline/metadata_fields.rb:91:in 'block in Crystalline::MetadataFields::ClassMethods#from_dict'
    lib/crystalline/metadata_fields.rb:68:in 'Array#each'
    lib/crystalline/metadata_fields.rb:68:in 'Crystalline::MetadataFields::ClassMethods#from_dict'
    lib/crystalline/module.rb:40:in 'Crystalline.unmarshal_json'
    lib/authlete/introspection.rb:268:in 'Authlete::Introspection#process_request'
    /opt/homebrew/lib/ruby/gems/4.0.0/gems/sorbet-runtime-0.6.12872/lib/types/private/methods/call_validation.rb:282:in 'UnboundMethod#bind_call'
    /opt/homebrew/lib/ruby/gems/4.0.0/gems/sorbet-runtime-0.6.12872/lib/types/private/methods/call_validation.rb:282:in 'T::Private::Methods::CallValidation.validate_call'
    /opt/homebrew/lib/ruby/gems/4.0.0/gems/sorbet-runtime-0.6.12872/lib/types/private/methods/_methods.rb:259:in 'block in Authlete::Introspection#_on_method_added'
    test/refresh_token_test.rb:109:in 'RefreshTokenFlowTest#test_refresh_token_flow'

5 runs, 20 assertions, 0 failures, 1 errors, 0 skips

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant