Msg/UpdateMetadata
UpdateMetadata is successful when:
- issuer is the voucher issuer
UpdateMetadata has the following outcomes:
- message response returned
- Content is updated in state
- EventUpdateMetadata is emitted
The issuer must be the voucher issuer
Background
Given voucher
{
"id": 1,
"issuer": "BTZfSbi0JKqguZ/tIAPUIhdAa7Y=",
"metadata": "chora:13toVfvC2YxrrfSXWB5h2BGHiXZURsKxWUz72uDRDSPMCrYPguGUXSC.rdf"
}
issuer is voucher issuer
When msg update metadata
{
"id": 1,
"issuer": "chora1q5m97jdcksj24g9enlkjqq75ygt5q6ak54jk38",
"new_metadata": "chora:13toVfwypkE1AwUzQmuBHk28WWwCa5QCynCrBuoYgMvN2iroywJ5Vi1.rdf"
}
Then expect no error.
issuer is not voucher issuer
When msg update metadata
{
"id": 1,
"issuer": "chora1s3x2yhc4qf59gf53hwsnhkh7gqa3eryxnu6nup",
"new_metadata": "chora:13toVfwypkE1AwUzQmuBHk28WWwCa5QCynCrBuoYgMvN2iroywJ5Vi1.rdf"
}
Then expect the error
issuer chora1s3x2yhc4qf59gf53hwsnhkh7gqa3eryxnu6nup: voucher issuer chora1q5m97jdcksj24g9enlkjqq75ygt5q6ak54jk38: unauthorized
The message response is returned
Background
Given voucher
{
"id": 1,
"issuer": "BTZfSbi0JKqguZ/tIAPUIhdAa7Y=",
"metadata": "chora:13toVfvC2YxrrfSXWB5h2BGHiXZURsKxWUz72uDRDSPMCrYPguGUXSC.rdf"
}
message response returned
When msg update metadata
{
"id": 1,
"issuer": "chora1q5m97jdcksj24g9enlkjqq75ygt5q6ak54jk38",
"new_metadata": "chora:13toVfwypkE1AwUzQmuBHk28WWwCa5QCynCrBuoYgMvN2iroywJ5Vi1.rdf"
}
Then expect response
{
"id": 1
}
Content is updated in state
Background
Given voucher
{
"id": 1,
"issuer": "BTZfSbi0JKqguZ/tIAPUIhdAa7Y=",
"metadata": "chora:13toVfvC2YxrrfSXWB5h2BGHiXZURsKxWUz72uDRDSPMCrYPguGUXSC.rdf"
}
state voucher updated
When msg update metadata
{
"id": 1,
"issuer": "chora1q5m97jdcksj24g9enlkjqq75ygt5q6ak54jk38",
"new_metadata": "chora:13toVfwypkE1AwUzQmuBHk28WWwCa5QCynCrBuoYgMvN2iroywJ5Vi1.rdf"
}
Then expect state voucher
{
"id": 1,
"issuer": "BTZfSbi0JKqguZ/tIAPUIhdAa7Y=",
"metadata": "chora:13toVfwypkE1AwUzQmuBHk28WWwCa5QCynCrBuoYgMvN2iroywJ5Vi1.rdf"
}
EventUpdateMetadata emitted
Background
Given voucher
{
"id": 1,
"issuer": "BTZfSbi0JKqguZ/tIAPUIhdAa7Y=",
"metadata": "chora:13toVfvC2YxrrfSXWB5h2BGHiXZURsKxWUz72uDRDSPMCrYPguGUXSC.rdf"
}
event update metadata emitted
When msg update metadata
{
"id": 1,
"issuer": "chora1q5m97jdcksj24g9enlkjqq75ygt5q6ak54jk38",
"new_metadata": "chora:13toVfwypkE1AwUzQmuBHk28WWwCa5QCynCrBuoYgMvN2iroywJ5Vi1.rdf"
}
Then expect event update metadata
{
"id": 1
}