Skip to content

Commit

Permalink
test: add pickup status message scenario (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Baliasnikov authored and mineme0110 committed Apr 30, 2024
1 parent f0655ef commit d0ccd63
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ data class MessagePickupStatus(
data class MessagePickupStatusBody(
val recipient_did: String,
val message_count: Int,
val longest_waited_seconds: Int,
val newest_received_time: Int,
val oldest_received_time: Int,
val total_bytes: Int,
val live_delivery: Boolean
val longest_waited_seconds: Int = 0,
val newest_received_time: Int = 0,
val oldest_received_time: Int = 0,
val total_bytes: Int = 0,
val live_delivery: Boolean = false
): JsonEncoded
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import io.iohk.atala.prism.walletsdk.domain.models.DID
import java.util.Base64
import io.iohk.atala.prism.walletsdk.domain.models.Message
import io.iohk.atala.prism.walletsdk.mercury.forward.ForwardMessage
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import models.MessagePickupStatusBody

class PickupMessageSteps {

Expand Down Expand Up @@ -54,7 +57,12 @@ class PickupMessageSteps {

@Then("Mediator responds with a status message detailing the queued messages of {actor}")
fun mediatorRespondsWithAStatusMessageDetailingTheQueuedMessagesOfRecipient(recipient: Actor) {
TODO("Not yet implemented https://input-output.atlassian.net/browse/ATL-4883")
val didcommMessage = EdgeAgent.unpackLastDidcommMessage()
val pickupStatus = Json.decodeFromString<MessagePickupStatusBody>(didcommMessage.body)
recipient.attemptsTo(
Ensure.that(pickupStatus.recipient_did).isEqualTo(recipient.recall<DID>("peerDid").toString()),
Ensure.that(pickupStatus.message_count).isGreaterThan(0)
)
}

@When("{actor} sends a delivery-request message")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Feature: Pickup message protocol

#Scenario: Recipient sends a status-request message
# Given Recipient sends a mediate request message to the mediator
# And Mediator responds to Recipient with mediate grant message
# And Sender sent a forward message to Recipient
# When Recipient sends a status-request message
# Then Mediator responds with a status message detailing the queued messages of Recipient
Scenario: Recipient sends a status-request message
Given Recipient sends a mediate request message to the mediator
And Mediator responds to Recipient with mediate grant message
And Sender sent a forward message to Recipient
When Recipient sends a status-request message
Then Mediator responds with a status message detailing the queued messages of Recipient

Scenario: Recipient sends a delivery-request message
Given Recipient sends a mediate request message to the mediator
Expand Down

0 comments on commit d0ccd63

Please sign in to comment.