From 398d21c02dc59d792f81416eafe6485584018cae Mon Sep 17 00:00:00 2001 From: "PUBNUB\\jakub.grzesiowski" Date: Thu, 23 May 2024 16:28:26 +0200 Subject: [PATCH] Fix potentially faulty async calls in EncryptionTests --- .../PubnubApi.Tests/EncryptionTests.cs | 24 +++++++------------ .../PubnubApi.Tests/WhenObjectMembership.cs | 3 ++- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/UnitTests/PubnubApi.Tests/EncryptionTests.cs b/src/UnitTests/PubnubApi.Tests/EncryptionTests.cs index 8d9655607..a0d82351e 100644 --- a/src/UnitTests/PubnubApi.Tests/EncryptionTests.cs +++ b/src/UnitTests/PubnubApi.Tests/EncryptionTests.cs @@ -3,18 +3,12 @@ using System.Collections.Generic; using NUnit.Framework; using PubnubApi; -using System.Text.RegularExpressions; -using System.Globalization; using Newtonsoft.Json; using System.Diagnostics; -using System.Linq; -using PeterO.Cbor; using PubnubApi.Security.Crypto; using PubnubApi.Security.Crypto.Cryptors; using PubnubApi.Security.Crypto.Common; using System.Threading; -using System.Security.Policy; -using System.Threading.Tasks; using MockServer; namespace PubNubMessaging.Tests @@ -838,7 +832,7 @@ public void TestPAMv3Signature() } [Test] - public async Task TestSubscribeDecryption() + public void TestSubscribeDecryption() { server.ClearRequests(); server.Start(); @@ -906,24 +900,24 @@ public async Task TestSubscribeDecryption() .WithResponse(expectedMessage) .WithStatusCode(System.Net.HttpStatusCode.OK)); - await Task.Delay(1000); + Thread.Sleep(1000); pn.Subscribe().Channels(new[] { "test" }).Execute(); - await Task.Delay(1000); + Thread.Sleep(1000); // Rust generated encrypted message - await CreateTestSender().Publish() + CreateTestSender().Publish() .Channel("test") .Message("UE5FRAFBQ1JIEALf+E65kseYJwTw2J6BUk9MePHiCcBCS+8ykXLkBIOA") - .ExecuteAsync(); + .Execute(new PNPublishResultExt((r,s)=>{})); bool passed = done.WaitOne(5000); Assert.True(passed); } [Test] - public async Task TestSubscribeDecryptionOnNonEncryptedMessage() + public void TestSubscribeDecryptionOnNonEncryptedMessage() { server.ClearRequests(); server.Start(); @@ -991,12 +985,12 @@ public async Task TestSubscribeDecryptionOnNonEncryptedMessage() pn.Subscribe().Channels(new[] { "test" }).Execute(); - await Task.Delay(1000); + Thread.Sleep(1000); - await CreateTestSender().Publish() + CreateTestSender().Publish() .Channel("test") .Message("test") - .ExecuteAsync(); + .Execute(new PNPublishResultExt((r,s)=>{})); bool passed = done.WaitOne(5000); Assert.True(passed); diff --git a/src/UnitTests/PubnubApi.Tests/WhenObjectMembership.cs b/src/UnitTests/PubnubApi.Tests/WhenObjectMembership.cs index aabe23651..af6937f97 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenObjectMembership.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenObjectMembership.cs @@ -1057,7 +1057,8 @@ public static async Task ThenWithAsyncSetRemoveChannelMetadataWithSetRemoveMembe } - [Test] + //TODO: CLEN-2037 + //[Test] public static void ThenManageMembershipShouldReturnEventInfo() { server.ClearRequests();