-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(x/data): add acceptance tests (#994)
* test(x/data): add acceptance tests * fix attest and mockgen * messge validation example * messge validation example * messge validation example * update server tests * define resolver * update server tests * update message tests * cleanup * resolver url error * resolver url error * update message validation * update message validation * update content hash validation * update server method tests * use define resolver * update format for steps with variables * use jsonpb and base64 hash * update content hash references * add content hash test case * add rules and update steps * add rules and no error * remove rules and refine steps * content hash no error * parse date and get data id * more specific scenarios * minor cleanup * valid scenario first * remove background text * separate message files
- Loading branch information
1 parent
e7f79fb
commit 93bd343
Showing
39 changed files
with
1,537 additions
and
825 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
Feature: MsgAnchor | ||
|
||
Scenario: a valid message | ||
Given the message | ||
""" | ||
{ | ||
"sender": "cosmos1depk54cuajgkzea6zpgkq36tnjwdzv4afc3d27", | ||
"content_hash": { | ||
"raw": { | ||
"hash": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=", | ||
"digest_algorithm": 1 | ||
} | ||
} | ||
} | ||
""" | ||
When the message is validated | ||
Then expect no error | ||
|
||
Scenario: an error is returned if sender is empty | ||
Given the message | ||
""" | ||
{} | ||
""" | ||
When the message is validated | ||
Then expect the error "empty address string is not allowed: invalid address" | ||
|
||
Scenario: an error is returned if sender is not a bech32 address | ||
Given the message | ||
""" | ||
{ | ||
"sender": "foo" | ||
} | ||
""" | ||
When the message is validated | ||
Then expect the error "decoding bech32 failed: invalid bech32 string length 3: invalid address" | ||
|
||
Scenario: an error is returned if content hash is empty | ||
Given the message | ||
""" | ||
{ | ||
"sender": "cosmos1depk54cuajgkzea6zpgkq36tnjwdzv4afc3d27" | ||
} | ||
""" | ||
When the message is validated | ||
Then expect the error "content hash cannot be empty: invalid request" | ||
|
||
# Note: see ./types_content_hash.feature for content hash validation |
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,48 @@ | ||
Feature: MsgAttest | ||
|
||
Scenario: a valid message | ||
Given the message | ||
""" | ||
{ | ||
"attestor": "cosmos1depk54cuajgkzea6zpgkq36tnjwdzv4afc3d27", | ||
"content_hashes": [ | ||
{ | ||
"hash": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=", | ||
"digest_algorithm": 1, | ||
"canonicalization_algorithm": 1 | ||
} | ||
] | ||
} | ||
""" | ||
When the message is validated | ||
Then expect no error | ||
|
||
Scenario: an error is returned if attestor is empty | ||
Given the message | ||
""" | ||
{} | ||
""" | ||
When the message is validated | ||
Then expect the error "empty address string is not allowed: invalid address" | ||
|
||
Scenario: an error is returned if attestor is not a bech32 address | ||
Given the message | ||
""" | ||
{ | ||
"attestor": "foo" | ||
} | ||
""" | ||
When the message is validated | ||
Then expect the error "decoding bech32 failed: invalid bech32 string length 3: invalid address" | ||
|
||
Scenario: an error is returned if content hashes is empty | ||
Given the message | ||
""" | ||
{ | ||
"attestor": "cosmos1depk54cuajgkzea6zpgkq36tnjwdzv4afc3d27" | ||
} | ||
""" | ||
When the message is validated | ||
Then expect the error "content hashes cannot be empty: invalid request" | ||
|
||
# Note: see ./types_content_hash.feature for content hash validation |
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,51 @@ | ||
Feature: MsgDefineResolver | ||
|
||
Scenario: a valid message | ||
Given the message | ||
""" | ||
{ | ||
"manager": "cosmos1depk54cuajgkzea6zpgkq36tnjwdzv4afc3d27", | ||
"resolver_url": "https://foo.bar" | ||
} | ||
""" | ||
When the message is validated | ||
Then expect no error | ||
|
||
Scenario: an error is returned if manager is empty | ||
Given the message | ||
""" | ||
{} | ||
""" | ||
When the message is validated | ||
Then expect the error "empty address string is not allowed: invalid address" | ||
|
||
Scenario: an error is returned if manager is not a bech32 address | ||
Given the message | ||
""" | ||
{ | ||
"manager": "foo" | ||
} | ||
""" | ||
When the message is validated | ||
Then expect the error "decoding bech32 failed: invalid bech32 string length 3: invalid address" | ||
|
||
Scenario: an error is returned if resolver url is empty | ||
Given the message | ||
""" | ||
{ | ||
"manager": "cosmos1depk54cuajgkzea6zpgkq36tnjwdzv4afc3d27" | ||
} | ||
""" | ||
When the message is validated | ||
Then expect the error "invalid resolver url: invalid request" | ||
|
||
Scenario: an error is returned if resolver url is missing a protocol | ||
Given the message | ||
""" | ||
{ | ||
"manager": "cosmos1depk54cuajgkzea6zpgkq36tnjwdzv4afc3d27", | ||
"resolver_url": "foo.bar" | ||
} | ||
""" | ||
When the message is validated | ||
Then expect the error "invalid resolver url: invalid request" |
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,61 @@ | ||
Feature: MsgRegisterResolver | ||
|
||
Scenario: a valid message | ||
Given the message | ||
""" | ||
{ | ||
"manager": "cosmos1depk54cuajgkzea6zpgkq36tnjwdzv4afc3d27", | ||
"resolver_id": 1, | ||
"content_hashes": [ | ||
{ | ||
"raw": { | ||
"hash": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=", | ||
"digest_algorithm": 1 | ||
} | ||
} | ||
] | ||
} | ||
""" | ||
When the message is validated | ||
Then expect no error | ||
|
||
Scenario: an error is returned if manager is empty | ||
Given the message | ||
""" | ||
{} | ||
""" | ||
When the message is validated | ||
Then expect the error "empty address string is not allowed: invalid address" | ||
|
||
Scenario: an error is returned if manager is not a bech32 address | ||
Given the message | ||
""" | ||
{ | ||
"manager": "foo" | ||
} | ||
""" | ||
When the message is validated | ||
Then expect the error "decoding bech32 failed: invalid bech32 string length 3: invalid address" | ||
|
||
Scenario: an error is returned if resolver id is empty | ||
Given the message | ||
""" | ||
{ | ||
"manager": "cosmos1depk54cuajgkzea6zpgkq36tnjwdzv4afc3d27" | ||
} | ||
""" | ||
When the message is validated | ||
Then expect the error "resolver id cannot be empty: invalid request" | ||
|
||
Scenario: an error is returned if content hashes is empty | ||
Given the message | ||
""" | ||
{ | ||
"manager": "cosmos1depk54cuajgkzea6zpgkq36tnjwdzv4afc3d27", | ||
"resolver_id": 1 | ||
} | ||
""" | ||
When the message is validated | ||
Then expect the error "content hashes cannot be empty: invalid request" | ||
|
||
# Note: see ./types_content_hash.feature for content hash validation |
Oops, something went wrong.