From 7bf2f6f74447c74a3a84e4be627bcf6262259234 Mon Sep 17 00:00:00 2001 From: gsutton Date: Mon, 13 Jan 2025 16:15:12 -0600 Subject: [PATCH] Add TokenHandler tests --- .../NatsConnectionTest.Auth.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/NATS.Client.Core.Tests/NatsConnectionTest.Auth.cs b/tests/NATS.Client.Core.Tests/NatsConnectionTest.Auth.cs index 11c6ac559..dbb10dbbd 100644 --- a/tests/NATS.Client.Core.Tests/NatsConnectionTest.Auth.cs +++ b/tests/NATS.Client.Core.Tests/NatsConnectionTest.Auth.cs @@ -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]