Skip to content

Commit

Permalink
test(OAuth2TokenProvider): added integration tests for OAuth2TokenPro…
Browse files Browse the repository at this point in the history
…vider
  • Loading branch information
LennartKleymann committed Nov 20, 2023
1 parent 418ae1c commit 346cde3
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions Client.IntegrationTests/OAuthIntegrationTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System.Threading.Tasks;
using Grpc.Core;
using NUnit.Framework;

namespace Client.IntegrationTests;

[TestFixture]
public class OAuthIntegrationTest
{
private readonly ZeebeIntegrationTestHelper testHelper = ZeebeIntegrationTestHelper.Latest(true);

[OneTimeSetUp]
public async Task Setup()
{
await testHelper.SetupIntegrationTest();
}

[OneTimeTearDown]
public async Task Stop()
{
await testHelper.TearDownIntegrationTest();
}

[Test]
public async Task ShouldSendRequestAndNotFailingWithAuthenticatedClient()
{
var topology = await testHelper.CreateAuthenticatedZeebeClient().TopologyRequest().Send();
var gatewayVersion = topology.GatewayVersion;
Assert.AreEqual(ZeebeIntegrationTestHelper.LatestVersion, gatewayVersion);

var topologyBrokers = topology.Brokers;
Assert.AreEqual(1, topologyBrokers.Count);

var topologyBroker = topologyBrokers[0];
Assert.AreEqual(0, topologyBroker.NodeId);
}

[Test]
public async Task ShouldFailWithUnauthenticatedClient()
{
Assert.ThrowsAsync<RpcException>(code: async () =>
{
await testHelper.CreateZeebeClient().TopologyRequest().Send();
});
}
}

0 comments on commit 346cde3

Please sign in to comment.