Skip to content

Commit 7f48ac1

Browse files
committed
Resource Tested for JSON marshalling : Grant
1 parent a3853d7 commit 7f48ac1

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

github/authorizations_test.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,3 +269,35 @@ func TestAuthorizationApp_Marshal(t *testing.T) {
269269

270270
testJSONMarshal(t, u, want)
271271
}
272+
273+
func TestGrant_Marshal(t *testing.T) {
274+
testJSONMarshal(t, &Grant{}, "{}")
275+
276+
u := &Grant{
277+
ID: Int64(1),
278+
URL: String("u"),
279+
App: &AuthorizationApp{
280+
URL: String("u"),
281+
Name: String("n"),
282+
ClientID: String("cid"),
283+
},
284+
CreatedAt: &Timestamp{referenceTime},
285+
UpdatedAt: &Timestamp{referenceTime},
286+
Scopes: []string{"s"},
287+
}
288+
289+
want := `{
290+
"id": 1,
291+
"url": "u",
292+
"app": {
293+
"url": "u",
294+
"name": "n",
295+
"client_id": "cid"
296+
},
297+
"created_at": ` + referenceTimeStr + `,
298+
"updated_at": ` + referenceTimeStr + `,
299+
"scopes": ["s"]
300+
}`
301+
302+
testJSONMarshal(t, u, want)
303+
}

0 commit comments

Comments
 (0)