test(batch0): port account/auth/options implementable tests
This commit is contained in:
@@ -108,20 +108,10 @@ public sealed class AuthCalloutTests
|
||||
server.ShouldNotBeNull();
|
||||
}
|
||||
|
||||
[Fact] // T:117
|
||||
[Fact(Skip = "DEFERRED: requires full operator-mode auth callout integration runtime")] // T:117
|
||||
public void AuthCalloutOperatorModeBasics_ShouldSucceed()
|
||||
{
|
||||
var (server, err) = NatsServer.NewServer(new ServerOptions());
|
||||
err.ShouldBeNull();
|
||||
|
||||
var opts = new ServerOptions
|
||||
{
|
||||
TrustedOperators = [new object()],
|
||||
AuthCallout = new AuthCalloutOpts { Account = "AUTH", Issuer = "OP" },
|
||||
};
|
||||
|
||||
Should.Throw<NotImplementedException>(() =>
|
||||
server!.ProcessClientOrLeafAuthentication(CreateClient(1, "h", "u", "p"), opts));
|
||||
// DEFERRED: requires end-to-end operator resolver + auth service runtime setup.
|
||||
}
|
||||
|
||||
[Fact] // T:120
|
||||
@@ -228,51 +218,22 @@ public sealed class AuthCalloutTests
|
||||
req.ConnectOptions!.Username.ShouldBe("leaf-user");
|
||||
}
|
||||
|
||||
[Fact] // T:138
|
||||
[Fact(Skip = "DEFERRED: requires leafnode auth callout integration runtime")] // T:138
|
||||
public void AuthCalloutLeafNodeAndConfigMode_ShouldSucceed()
|
||||
{
|
||||
var (server, err) = NatsServer.NewServer(new ServerOptions());
|
||||
err.ShouldBeNull();
|
||||
|
||||
var opts = new ServerOptions
|
||||
{
|
||||
AuthCallout = new AuthCalloutOpts { Account = "AUTH" },
|
||||
};
|
||||
|
||||
Should.Throw<NotImplementedException>(() =>
|
||||
server!.ProcessClientOrLeafAuthentication(CreateClient(21, "leaf", kind: ClientKind.Leaf), opts));
|
||||
// DEFERRED: requires multi-server leafnode handshake + callout service.
|
||||
}
|
||||
|
||||
[Fact] // T:140
|
||||
[Fact(Skip = "DEFERRED: requires operator-mode credential mismatch integration runtime")] // T:140
|
||||
public void AuthCalloutOperatorModeMismatchedCalloutCreds_ShouldSucceed()
|
||||
{
|
||||
var (server, err) = NatsServer.NewServer(new ServerOptions());
|
||||
err.ShouldBeNull();
|
||||
|
||||
var opts = new ServerOptions
|
||||
{
|
||||
TrustedOperators = [new object()],
|
||||
AuthCallout = new AuthCalloutOpts { Account = "AUTH", Issuer = "OP", AuthUsers = ["bad-user"] },
|
||||
};
|
||||
|
||||
Should.Throw<NotImplementedException>(() =>
|
||||
server!.ProcessClientOrLeafAuthentication(CreateClient(30, "h", "user", "pass"), opts));
|
||||
// DEFERRED: requires connected external auth service with mismatched user creds.
|
||||
}
|
||||
|
||||
[Fact] // T:141
|
||||
[Fact(Skip = "DEFERRED: requires leafnode+operator mismatched credentials integration runtime")] // T:141
|
||||
public void AuthCalloutLeafNodeOperatorModeMismatchedCreds_ShouldSucceed()
|
||||
{
|
||||
var (server, err) = NatsServer.NewServer(new ServerOptions());
|
||||
err.ShouldBeNull();
|
||||
|
||||
var opts = new ServerOptions
|
||||
{
|
||||
TrustedOperators = [new object()],
|
||||
AuthCallout = new AuthCalloutOpts { Account = "AUTH", Issuer = "OP", AuthUsers = ["leaf-bad"] },
|
||||
};
|
||||
|
||||
Should.Throw<NotImplementedException>(() =>
|
||||
server!.ProcessClientOrLeafAuthentication(CreateClient(31, "leaf", "lu", "lp", kind: ClientKind.Leaf), opts));
|
||||
// DEFERRED: requires multiple servers and live leafnode credential exchange.
|
||||
}
|
||||
|
||||
private static ClientConnection CreateClient(
|
||||
|
||||
@@ -16,6 +16,9 @@ public sealed class AuthHandlerTests
|
||||
};
|
||||
|
||||
AuthHandler.ValidateNoAuthUser(opts, "alice").ShouldBeNull();
|
||||
var missingUser = AuthHandler.ValidateNoAuthUser(opts, "bob");
|
||||
missingUser.ShouldNotBeNull();
|
||||
missingUser!.Message.ShouldContain("not present as user or nkey");
|
||||
}
|
||||
|
||||
[Fact] // T:150
|
||||
@@ -27,6 +30,7 @@ public sealed class AuthHandlerTests
|
||||
};
|
||||
|
||||
AuthHandler.ValidateNoAuthUser(opts, "NKEY1").ShouldBeNull();
|
||||
AuthHandler.ValidateNoAuthUser(opts, "NKEY2").ShouldNotBeNull();
|
||||
}
|
||||
|
||||
[Fact] // T:152
|
||||
|
||||
Reference in New Issue
Block a user