feat(lmxproxy): phase 3 — host gRPC server, security, configuration, service hosting
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
using FluentAssertions;
|
||||
using Xunit;
|
||||
|
||||
namespace ZB.MOM.WW.LmxProxy.Host.Tests.Security
|
||||
{
|
||||
public class ApiKeyInterceptorTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("/scada.ScadaService/Write")]
|
||||
[InlineData("/scada.ScadaService/WriteBatch")]
|
||||
[InlineData("/scada.ScadaService/WriteBatchAndWait")]
|
||||
public void WriteProtectedMethods_AreCorrectlyDefined(string method)
|
||||
{
|
||||
// This test verifies the set of write-protected methods is correct.
|
||||
// The actual interceptor logic is tested via integration tests.
|
||||
var writeProtected = new System.Collections.Generic.HashSet<string>(
|
||||
System.StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
"/scada.ScadaService/Write",
|
||||
"/scada.ScadaService/WriteBatch",
|
||||
"/scada.ScadaService/WriteBatchAndWait"
|
||||
};
|
||||
writeProtected.Should().Contain(method);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("/scada.ScadaService/Connect")]
|
||||
[InlineData("/scada.ScadaService/Disconnect")]
|
||||
[InlineData("/scada.ScadaService/GetConnectionState")]
|
||||
[InlineData("/scada.ScadaService/Read")]
|
||||
[InlineData("/scada.ScadaService/ReadBatch")]
|
||||
[InlineData("/scada.ScadaService/Subscribe")]
|
||||
[InlineData("/scada.ScadaService/CheckApiKey")]
|
||||
public void ReadMethods_AreNotWriteProtected(string method)
|
||||
{
|
||||
var writeProtected = new System.Collections.Generic.HashSet<string>(
|
||||
System.StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
"/scada.ScadaService/Write",
|
||||
"/scada.ScadaService/WriteBatch",
|
||||
"/scada.ScadaService/WriteBatchAndWait"
|
||||
};
|
||||
writeProtected.Should().NotContain(method);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user