diff --git a/fixtures/users.go b/fixtures/users.go index 3add148..8e954ca 100644 --- a/fixtures/users.go +++ b/fixtures/users.go @@ -2,7 +2,6 @@ package fixtures import ( "encoding/json" - "fmt" ) const MarcusUserResponse = `{ @@ -172,14 +171,24 @@ const PaginatedResponseTmpl = `{ "schemas" : [ "urn:scim:schemas:core:1.0"] }` +// PaginatedResponseStruct represents a paginated SCIM response +type PaginatedResponseStruct struct { + Resources []interface{} `json:"resources"` + StartIndex int `json:"startIndex"` + ItemsPerPage int `json:"itemsPerPage"` + TotalResults int `json:"totalResults"` + Schemas []string `json:"schemas"` +} + func PaginatedResponse(resources ...interface{}) string { - bytes, _ := json.Marshal(resources) + response := PaginatedResponseStruct{ + Resources: resources, + StartIndex: 1, + ItemsPerPage: 50, + TotalResults: len(resources), + Schemas: []string{"urn:scim:schemas:core:1.0"}, + } - return fmt.Sprintf(`{ - "resources": %v, - "startIndex" : 1, - "itemsPerPage" : 50, - "totalResults" : %v, - "schemas" : [ "urn:scim:schemas:core:1.0"] - }`, string(bytes), len(resources)) + bytes, _ := json.Marshal(response) + return string(bytes) }