Skip to content
Snippets Groups Projects
Unverified Commit 53757395 authored by chris-cwa's avatar chris-cwa Committed by GitHub
Browse files

use copy constructor, made 'invalidated'-flag optional (#2432)

parent fd69ed4b
No related branches found
No related tags found
No related merge requests found
...@@ -14,8 +14,8 @@ data class OTPAuthorizationResult( ...@@ -14,8 +14,8 @@ data class OTPAuthorizationResult(
@SerializedName("redeemedAt") @SerializedName("redeemedAt")
val redeemedAt: Instant, val redeemedAt: Instant,
@SerializedName("invalidated") @SerializedName("invalidated")
val invalidated: Boolean val invalidated: Boolean = false
) { ) {
fun toInvalidatedInstance() = OTPAuthorizationResult(uuid, authorized, redeemedAt, true) fun toInvalidatedInstance() = copy(invalidated = true)
} }
...@@ -93,8 +93,7 @@ class Surveys @Inject constructor( ...@@ -93,8 +93,7 @@ class Surveys @Inject constructor(
val result = OTPAuthorizationResult( val result = OTPAuthorizationResult(
uuid = oneTimePassword.uuid, uuid = oneTimePassword.uuid,
authorized = errorCode == null, authorized = errorCode == null,
redeemedAt = now, redeemedAt = now
invalidated = false
) )
oneTimePasswordRepo.otpAuthorizationResult = result oneTimePasswordRepo.otpAuthorizationResult = result
......
...@@ -69,8 +69,7 @@ class OTPRepositoryTest : BaseTest() { ...@@ -69,8 +69,7 @@ class OTPRepositoryTest : BaseTest() {
settings.otpAuthorizationResult = OTPAuthorizationResult( settings.otpAuthorizationResult = OTPAuthorizationResult(
UUID.randomUUID(), UUID.randomUUID(),
true, true,
Instant.now(), Instant.now()
false
) )
settings.otpAuthorizationResult shouldNotBe null settings.otpAuthorizationResult shouldNotBe null
...@@ -88,8 +87,7 @@ class OTPRepositoryTest : BaseTest() { ...@@ -88,8 +87,7 @@ class OTPRepositoryTest : BaseTest() {
OTPRepository(settings).otpAuthorizationResult = OTPAuthorizationResult( OTPRepository(settings).otpAuthorizationResult = OTPAuthorizationResult(
UUID.randomUUID(), UUID.randomUUID(),
true, true,
Instant.now(), Instant.now()
false
) )
settings.oneTimePassword shouldBe null settings.oneTimePassword shouldBe null
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment