File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff 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+ }
You can’t perform that action at this time.
0 commit comments