Skip to content

Commit

Permalink
Add test cases for JSON resource marshaling (google#2524)
Browse files Browse the repository at this point in the history
  • Loading branch information
sayalideshmukh10 authored and Harikesh00 committed Oct 25, 2022
1 parent 8b03a1a commit 863155e
Showing 1 changed file with 56 additions and 1 deletion.
57 changes: 56 additions & 1 deletion github/scim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,62 @@ func TestSCIMUserAttributes_Marshal(t *testing.T) {
testJSONMarshal(t, u, want)
}

func TestUpdateAttributeForSCIMUserOperations_Marshal(t *testing.T) {
testJSONMarshal(t, &UpdateAttributeForSCIMUserOperations{}, `{}`)

u := &UpdateAttributeForSCIMUserOperations{
Op: "TestOp",
Path: String("path"),
}

want := `{
"op": "TestOp",
"path": "path"
}`

testJSONMarshal(t, u, want)
}

func TestUpdateAttributeForSCIMUserOptions_Marshal(t *testing.T) {
testJSONMarshal(t, &UpdateAttributeForSCIMUserOptions{}, `{}`)

u := &UpdateAttributeForSCIMUserOptions{
Schemas: []string{"test", "schema"},
Operations: UpdateAttributeForSCIMUserOperations{
Op: "TestOp",
Path: String("path"),
},
}

want := `{
"schemas": ["test", "schema"],
"operations": {
"op": "TestOp",
"path": "path"
}
}`

testJSONMarshal(t, u, want)
}

func TestListSCIMProvisionedIdentitiesOptions_Marshal(t *testing.T) {
testJSONMarshal(t, &ListSCIMProvisionedIdentitiesOptions{}, `{}`)

u := &ListSCIMProvisionedIdentitiesOptions{
StartIndex: Int(1),
Count: Int(10),
Filter: String("test"),
}

want := `{
"startIndex": 1,
"count": 10,
"filter": "test"
}`

testJSONMarshal(t, u, want)
}

func TestSCIMUserName_Marshal(t *testing.T) {
testJSONMarshal(t, &SCIMUserName{}, `{
"givenName":"","familyName":""
Expand All @@ -406,6 +462,5 @@ func TestSCIMUserName_Marshal(t *testing.T) {
"familyName": "Fname",
"formatted": "formatted name"
}`

testJSONMarshal(t, u, want)
}

0 comments on commit 863155e

Please sign in to comment.