Fixes test cases
This commit is contained in:
+4
-1
@@ -25,6 +25,7 @@ import com.vitorpamplona.nestsclient.OkHttpNestsClient
|
|||||||
import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair
|
import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair
|
||||||
import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal
|
import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
import org.junit.AfterClass
|
import org.junit.AfterClass
|
||||||
import org.junit.BeforeClass
|
import org.junit.BeforeClass
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@@ -41,6 +42,8 @@ import kotlin.test.assertTrue
|
|||||||
* Skipped by default — set `-DnestsInterop=true` to enable.
|
* Skipped by default — set `-DnestsInterop=true` to enable.
|
||||||
*/
|
*/
|
||||||
class NostrNestsAuthInteropTest {
|
class NostrNestsAuthInteropTest {
|
||||||
|
val client = OkHttpNestsClient { OkHttpClient() }
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun production_OkHttpNestsClient_mints_a_jwt_against_real_moq_auth() =
|
fun production_OkHttpNestsClient_mints_a_jwt_against_real_moq_auth() =
|
||||||
runBlocking {
|
runBlocking {
|
||||||
@@ -48,7 +51,7 @@ class NostrNestsAuthInteropTest {
|
|||||||
val harness = harnessOrNull ?: return@runBlocking
|
val harness = harnessOrNull ?: return@runBlocking
|
||||||
|
|
||||||
val signer = NostrSignerInternal(KeyPair())
|
val signer = NostrSignerInternal(KeyPair())
|
||||||
val client = OkHttpNestsClient()
|
|
||||||
val room =
|
val room =
|
||||||
NestsRoomConfig(
|
NestsRoomConfig(
|
||||||
authBaseUrl = harness.authBaseUrl,
|
authBaseUrl = harness.authBaseUrl,
|
||||||
|
|||||||
+2
-1
@@ -38,6 +38,7 @@ import kotlinx.coroutines.flow.take
|
|||||||
import kotlinx.coroutines.flow.toList
|
import kotlinx.coroutines.flow.toList
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import kotlinx.coroutines.withTimeoutOrNull
|
import kotlinx.coroutines.withTimeoutOrNull
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
import org.junit.AfterClass
|
import org.junit.AfterClass
|
||||||
import org.junit.BeforeClass
|
import org.junit.BeforeClass
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@@ -178,7 +179,7 @@ class NostrNestsLateJoinInteropTest {
|
|||||||
private const val FRAME_SPACING_MS = 25L
|
private const val FRAME_SPACING_MS = 25L
|
||||||
private const val RECEIVE_TIMEOUT_MS = 10_000L
|
private const val RECEIVE_TIMEOUT_MS = 10_000L
|
||||||
|
|
||||||
private val httpClient = OkHttpNestsClient()
|
private val httpClient = OkHttpNestsClient { OkHttpClient() }
|
||||||
private val transport =
|
private val transport =
|
||||||
QuicWebTransportFactory(certificateValidator = PermissiveCertificateValidator())
|
QuicWebTransportFactory(certificateValidator = PermissiveCertificateValidator())
|
||||||
private var harnessOrNull: NostrNestsHarness? = null
|
private var harnessOrNull: NostrNestsHarness? = null
|
||||||
|
|||||||
+2
-1
@@ -46,6 +46,7 @@ import kotlinx.coroutines.flow.take
|
|||||||
import kotlinx.coroutines.flow.toList
|
import kotlinx.coroutines.flow.toList
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import kotlinx.coroutines.withTimeoutOrNull
|
import kotlinx.coroutines.withTimeoutOrNull
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
import org.junit.AfterClass
|
import org.junit.AfterClass
|
||||||
import org.junit.BeforeClass
|
import org.junit.BeforeClass
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@@ -452,7 +453,7 @@ class NostrNestsMultiPeerInteropTest {
|
|||||||
private const val FRAME_SPACING_MS = 25L
|
private const val FRAME_SPACING_MS = 25L
|
||||||
private const val RECEIVE_TIMEOUT_MS = 15_000L
|
private const val RECEIVE_TIMEOUT_MS = 15_000L
|
||||||
|
|
||||||
private val http = OkHttpNestsClient()
|
private val http = OkHttpNestsClient { OkHttpClient() }
|
||||||
private val transport =
|
private val transport =
|
||||||
QuicWebTransportFactory(certificateValidator = PermissiveCertificateValidator())
|
QuicWebTransportFactory(certificateValidator = PermissiveCertificateValidator())
|
||||||
private var harnessOrNull: NostrNestsHarness? = null
|
private var harnessOrNull: NostrNestsHarness? = null
|
||||||
|
|||||||
+2
-1
@@ -38,6 +38,7 @@ import kotlinx.coroutines.flow.take
|
|||||||
import kotlinx.coroutines.flow.toList
|
import kotlinx.coroutines.flow.toList
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import kotlinx.coroutines.withTimeoutOrNull
|
import kotlinx.coroutines.withTimeoutOrNull
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
import org.junit.AfterClass
|
import org.junit.AfterClass
|
||||||
import org.junit.BeforeClass
|
import org.junit.BeforeClass
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@@ -174,7 +175,7 @@ class NostrNestsMuteInteropTest {
|
|||||||
private const val MUTE_BOUNDARY_MS = 200L
|
private const val MUTE_BOUNDARY_MS = 200L
|
||||||
private const val RECEIVE_TIMEOUT_MS = 10_000L
|
private const val RECEIVE_TIMEOUT_MS = 10_000L
|
||||||
|
|
||||||
private val httpClient = OkHttpNestsClient()
|
private val httpClient = OkHttpNestsClient { OkHttpClient() }
|
||||||
private val transport =
|
private val transport =
|
||||||
QuicWebTransportFactory(certificateValidator = PermissiveCertificateValidator())
|
QuicWebTransportFactory(certificateValidator = PermissiveCertificateValidator())
|
||||||
private var harnessOrNull: NostrNestsHarness? = null
|
private var harnessOrNull: NostrNestsHarness? = null
|
||||||
|
|||||||
+4
-3
@@ -48,6 +48,7 @@ import kotlinx.coroutines.flow.take
|
|||||||
import kotlinx.coroutines.flow.toList
|
import kotlinx.coroutines.flow.toList
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import kotlinx.coroutines.withTimeoutOrNull
|
import kotlinx.coroutines.withTimeoutOrNull
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
import org.junit.AfterClass
|
import org.junit.AfterClass
|
||||||
import org.junit.BeforeClass
|
import org.junit.BeforeClass
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@@ -94,7 +95,7 @@ class NostrNestsReconnectingListenerInteropTest {
|
|||||||
roomId = "rec-${System.currentTimeMillis()}",
|
roomId = "rec-${System.currentTimeMillis()}",
|
||||||
)
|
)
|
||||||
|
|
||||||
val httpClient = OkHttpNestsClient()
|
val httpClient = OkHttpNestsClient { OkHttpClient() }
|
||||||
val transport =
|
val transport =
|
||||||
QuicWebTransportFactory(
|
QuicWebTransportFactory(
|
||||||
certificateValidator = PermissiveCertificateValidator(),
|
certificateValidator = PermissiveCertificateValidator(),
|
||||||
@@ -213,7 +214,7 @@ class NostrNestsReconnectingListenerInteropTest {
|
|||||||
roomId = "swap-${System.currentTimeMillis()}",
|
roomId = "swap-${System.currentTimeMillis()}",
|
||||||
)
|
)
|
||||||
|
|
||||||
val httpClient = OkHttpNestsClient()
|
val httpClient = OkHttpNestsClient { OkHttpClient() }
|
||||||
val transport =
|
val transport =
|
||||||
QuicWebTransportFactory(
|
QuicWebTransportFactory(
|
||||||
certificateValidator = PermissiveCertificateValidator(),
|
certificateValidator = PermissiveCertificateValidator(),
|
||||||
@@ -450,7 +451,7 @@ class NostrNestsReconnectingListenerInteropTest {
|
|||||||
roomId = "lst-pub-cycle-${System.currentTimeMillis()}",
|
roomId = "lst-pub-cycle-${System.currentTimeMillis()}",
|
||||||
)
|
)
|
||||||
|
|
||||||
val httpClient = OkHttpNestsClient()
|
val httpClient = OkHttpNestsClient { OkHttpClient() }
|
||||||
val transport =
|
val transport =
|
||||||
QuicWebTransportFactory(
|
QuicWebTransportFactory(
|
||||||
certificateValidator = PermissiveCertificateValidator(),
|
certificateValidator = PermissiveCertificateValidator(),
|
||||||
|
|||||||
+2
-1
@@ -47,6 +47,7 @@ import kotlinx.coroutines.flow.toList
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import kotlinx.coroutines.withTimeoutOrNull
|
import kotlinx.coroutines.withTimeoutOrNull
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
import org.junit.AfterClass
|
import org.junit.AfterClass
|
||||||
import org.junit.BeforeClass
|
import org.junit.BeforeClass
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@@ -220,7 +221,7 @@ class NostrNestsReconnectingSpeakerInteropTest {
|
|||||||
roomId = "spk-refr-${System.currentTimeMillis()}",
|
roomId = "spk-refr-${System.currentTimeMillis()}",
|
||||||
)
|
)
|
||||||
|
|
||||||
val httpClient = OkHttpNestsClient()
|
val httpClient = OkHttpNestsClient { OkHttpClient() }
|
||||||
val transport =
|
val transport =
|
||||||
QuicWebTransportFactory(
|
QuicWebTransportFactory(
|
||||||
certificateValidator = PermissiveCertificateValidator(),
|
certificateValidator = PermissiveCertificateValidator(),
|
||||||
|
|||||||
+2
-1
@@ -43,6 +43,7 @@ import kotlinx.coroutines.flow.take
|
|||||||
import kotlinx.coroutines.flow.toList
|
import kotlinx.coroutines.flow.toList
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import kotlinx.coroutines.withTimeoutOrNull
|
import kotlinx.coroutines.withTimeoutOrNull
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
import org.junit.AfterClass
|
import org.junit.AfterClass
|
||||||
import org.junit.BeforeClass
|
import org.junit.BeforeClass
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@@ -99,7 +100,7 @@ class NostrNestsRoundTripInteropTest {
|
|||||||
roomId = "rt-${System.currentTimeMillis()}",
|
roomId = "rt-${System.currentTimeMillis()}",
|
||||||
)
|
)
|
||||||
|
|
||||||
val httpClient = OkHttpNestsClient()
|
val httpClient = OkHttpNestsClient { OkHttpClient() }
|
||||||
// Self-signed dev cert on the relay — production uses
|
// Self-signed dev cert on the relay — production uses
|
||||||
// JdkCertificateValidator; the type system forces us to pass a
|
// JdkCertificateValidator; the type system forces us to pass a
|
||||||
// permissive validator explicitly here.
|
// permissive validator explicitly here.
|
||||||
|
|||||||
+2
-1
@@ -37,6 +37,7 @@ import kotlinx.coroutines.delay
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import kotlinx.coroutines.withTimeoutOrNull
|
import kotlinx.coroutines.withTimeoutOrNull
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
import org.junit.AfterClass
|
import org.junit.AfterClass
|
||||||
import org.junit.BeforeClass
|
import org.junit.BeforeClass
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@@ -186,7 +187,7 @@ class NostrNestsSpeakerCloseInteropTest {
|
|||||||
private const val FRAME_SPACING_MS = 25L
|
private const val FRAME_SPACING_MS = 25L
|
||||||
private const val CLOSE_TIMEOUT_MS = 5_000L
|
private const val CLOSE_TIMEOUT_MS = 5_000L
|
||||||
|
|
||||||
private val httpClient = OkHttpNestsClient()
|
private val httpClient = OkHttpNestsClient { OkHttpClient() }
|
||||||
private val transport =
|
private val transport =
|
||||||
QuicWebTransportFactory(certificateValidator = PermissiveCertificateValidator())
|
QuicWebTransportFactory(certificateValidator = PermissiveCertificateValidator())
|
||||||
private var harnessOrNull: NostrNestsHarness? = null
|
private var harnessOrNull: NostrNestsHarness? = null
|
||||||
|
|||||||
+2
-1
@@ -38,6 +38,7 @@ import kotlinx.coroutines.flow.take
|
|||||||
import kotlinx.coroutines.flow.toList
|
import kotlinx.coroutines.flow.toList
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import kotlinx.coroutines.withTimeoutOrNull
|
import kotlinx.coroutines.withTimeoutOrNull
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
import org.junit.AfterClass
|
import org.junit.AfterClass
|
||||||
import org.junit.BeforeClass
|
import org.junit.BeforeClass
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@@ -175,7 +176,7 @@ class NostrNestsUnsubscribeInteropTest {
|
|||||||
private const val FRAME_SPACING_MS = 25L
|
private const val FRAME_SPACING_MS = 25L
|
||||||
private const val RECEIVE_TIMEOUT_MS = 10_000L
|
private const val RECEIVE_TIMEOUT_MS = 10_000L
|
||||||
|
|
||||||
private val httpClient = OkHttpNestsClient()
|
private val httpClient = OkHttpNestsClient { OkHttpClient() }
|
||||||
private val transport =
|
private val transport =
|
||||||
QuicWebTransportFactory(certificateValidator = PermissiveCertificateValidator())
|
QuicWebTransportFactory(certificateValidator = PermissiveCertificateValidator())
|
||||||
private var harnessOrNull: NostrNestsHarness? = null
|
private var harnessOrNull: NostrNestsHarness? = null
|
||||||
|
|||||||
Reference in New Issue
Block a user