Skip to content

Commit

Permalink
Add test cases for JSON resource marshaling (#2524)
Browse files Browse the repository at this point in the history
  • Loading branch information
sayalideshmukh10 committed Oct 25, 2022
1 parent 3cb9c66 commit 33c3e88
Showing 1 changed file with 56 additions and 1 deletion.
57 changes: 56 additions & 1 deletion github/scim_test.go
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 33c3e88

Please sign in to comment.