-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(OAuth2TokenProvider): added integration tests for OAuth2TokenPro…
…vider
- Loading branch information
1 parent
418ae1c
commit 346cde3
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
} | ||
} |