Skip to content

Commit

Permalink
Add TokenHandler tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gsutton committed Jan 13, 2025
1 parent dbad8c8 commit 7bf2f6f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/NATS.Client.Core.Tests/NatsConnectionTest.Auth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,25 @@ NatsOpts.Default with
AuthOpts = NatsAuthOpts.Default with { CredsFile = "resources/configs/auth/user.creds", },
}),
};

yield return new object[]
{
new Auth(
"TokenHandler",
"resources/configs/auth/token.conf",
NatsOpts.Default with
{
AuthOpts = NatsAuthOpts.Default with { TokenHandler = () => "s3cr3t", },
}),
};

yield return new object[]
{
new Auth(
"TokenHandler takes precedence over Token",
"resources/configs/auth/token.conf",
NatsOpts.Default with { AuthOpts = NatsAuthOpts.Default with { Token = "won't be used", TokenHandler = () => "s3cr3t" }, }),
};
}

[Theory]
Expand Down

0 comments on commit 7bf2f6f

Please sign in to comment.