-
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
9d5507e
commit 512ca1e
Showing
5 changed files
with
62 additions
and
9 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
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
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
26 changes: 26 additions & 0 deletions
26
...r-core/src/test/kotlin/com/lightningkite/lightningserver/files/UploadEarlyEndpointTest.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,26 @@ | ||
package com.lightningkite.lightningserver.files | ||
|
||
import com.lightningkite.default | ||
import com.lightningkite.lightningserver.TestSettings | ||
import com.lightningkite.lightningserver.core.ServerPath | ||
import com.lightningkite.now | ||
import kotlinx.datetime.Clock | ||
import kotlinx.datetime.Instant | ||
import org.junit.Assert.* | ||
import java.util.UUID | ||
import kotlin.test.Test | ||
import kotlin.time.Duration.Companion.milliseconds | ||
|
||
class UploadEarlyEndpointTest { | ||
@Test fun testSigning() { | ||
var now = now() | ||
Clock.default = object: Clock { | ||
override fun now(): Instant = now | ||
} | ||
repeat(1000) { | ||
now.plus(1.milliseconds) | ||
assertTrue(TestSettings.earlyUpload.verifyUrl(TestSettings.earlyUpload.signUrl("https://test.com/test.jpg"))) | ||
} | ||
Clock.default = Clock.System | ||
} | ||
} |