generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added pagination to schemas. * Added pagination integration test for schemas. * tags
- Loading branch information
1 parent
028dbf9
commit fa6477d
Showing
7 changed files
with
116 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package integration | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestListSchemaIntegration(t *testing.T) { | ||
if testing.Short() { | ||
t.Skip("skipping integration test") | ||
} | ||
|
||
// In this test we create a couple of schemas, fetch them all using pagination, and validate that the created ones | ||
// were returned in any of the results. | ||
schema1, err := CreateKYCSchema() | ||
assert.NoError(t, err) | ||
|
||
schema1ID, err := getJSONElement(schema1, "$.id") | ||
assert.NoError(t, err) | ||
|
||
schema2, err := CreateKYCSchema() | ||
assert.NoError(t, err) | ||
|
||
schema2ID, err := getJSONElement(schema2, "$.id") | ||
assert.NoError(t, err) | ||
|
||
schemasPage, err := get(endpoint + version + "schemas?pageSize=1") | ||
assert.NoError(t, err) | ||
|
||
var allSchemaIDs string | ||
allSchemaIDs = schemasPage | ||
|
||
nextPageToken, err := getJSONElement(schemasPage, "$.nextPageToken") | ||
assert.NoError(t, err) | ||
|
||
for nextPageToken != "" { | ||
schemasPage, err := get(endpoint + version + "schemas?pageSize=1&pageToken=" + nextPageToken) | ||
assert.NoError(t, err) | ||
|
||
allSchemaIDs += schemasPage | ||
|
||
nextPageToken, err = getJSONElement(schemasPage, "$.nextPageToken") | ||
assert.NoError(t, err) | ||
} | ||
|
||
assert.Contains(t, allSchemaIDs, schema1ID) | ||
assert.Contains(t, allSchemaIDs, schema2ID) | ||
} |
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
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