Skip to content

Commit f271152

Browse files
Add test cases for JSON resource marshaling - SCIM (#3798)
1 parent 53d0e6a commit f271152

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

github/scim_test.go

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,3 +698,62 @@ func TestSCIMProvisionedIdentities_Marshal(t *testing.T) {
698698

699699
testJSONMarshal(t, u, want)
700700
}
701+
702+
func TestSCIMProvisionedGroups_Marshal(t *testing.T) {
703+
t.Parallel()
704+
testJSONMarshal(t, &SCIMProvisionedGroups{}, "{}")
705+
706+
u := &SCIMProvisionedGroups{
707+
Schemas: []string{"s1"},
708+
TotalResults: Ptr(1),
709+
ItemsPerPage: Ptr(2),
710+
StartIndex: Ptr(3),
711+
Resources: []*SCIMGroupAttributes{
712+
{
713+
DisplayName: Ptr("dn"),
714+
Members: []*SCIMDisplayReference{
715+
{
716+
Value: "v",
717+
Ref: "r",
718+
Display: Ptr("d"),
719+
},
720+
},
721+
Schemas: []string{"s2"},
722+
ExternalID: Ptr("eid"),
723+
ID: Ptr("id"),
724+
Meta: &SCIMMeta{
725+
ResourceType: Ptr("rt"),
726+
Created: &Timestamp{referenceTime},
727+
LastModified: &Timestamp{referenceTime},
728+
Location: Ptr("l"),
729+
},
730+
},
731+
},
732+
}
733+
734+
want := `{
735+
"schemas": ["s1"],
736+
"totalResults": 1,
737+
"itemsPerPage": 2,
738+
"startIndex": 3,
739+
"Resources": [{
740+
"displayName": "dn",
741+
"members": [{
742+
"value": "v",
743+
"$ref": "r",
744+
"display": "d"
745+
}]
746+
,"schemas": ["s2"],
747+
"externalId": "eid",
748+
"id": "id",
749+
"meta": {
750+
"resourceType": "rt",
751+
"created": ` + referenceTimeStr + `,
752+
"lastModified": ` + referenceTimeStr + `,
753+
"location": "l"
754+
}
755+
}]
756+
}`
757+
758+
testJSONMarshal(t, u, want)
759+
}

0 commit comments

Comments
 (0)