-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cac3893
commit 9c518d2
Showing
3 changed files
with
33 additions
and
1 deletion.
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
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
31 changes: 31 additions & 0 deletions
31
...e/src/test/kotlin/com/lightningkite/lightningserver/auth/proof/EmailProofEndpointsTest.kt
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,31 @@ | ||
package com.lightningkite.lightningserver.auth.proof | ||
|
||
import com.lightningkite.lightningserver.TestSettings | ||
import com.lightningkite.lightningserver.email.Email | ||
import com.lightningkite.lightningserver.email.EmailLabeledValue | ||
import com.lightningkite.lightningserver.email.TestEmailClient | ||
import com.lightningkite.lightningserver.serialization.Serialization | ||
import io.ktor.http.* | ||
import kotlinx.coroutines.runBlocking | ||
import kotlinx.serialization.encodeToString | ||
import org.junit.Assert.* | ||
import org.junit.Test | ||
import java.util.Base64 | ||
|
||
class EmailProofEndpointsTest { | ||
@Test fun test(): Unit = runBlocking { | ||
TestSettings.proofEmail.send("[email protected]") { proof -> | ||
Email( | ||
to = listOf(EmailLabeledValue("[email protected]")), | ||
subject = "Login", | ||
plainText = """ | ||
|Test got proof | ||
|${Serialization.json.encodeToString(proof).encodeURLQueryComponent()} | ||
|${Serialization.json.encodeToString(proof).let{ Base64.getEncoder().encodeToString(it.toByteArray()) }} | ||
|""".trimMargin() | ||
) | ||
} | ||
assertNotNull(TestEmailClient.lastEmailSent) | ||
TestEmailClient.lastEmailSent?.plainText?.let { println(it) } | ||
} | ||
} |