File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -206,3 +206,51 @@ func TestActionsService_GetAlert(t *testing.T) {
206206 return resp , err
207207 })
208208}
209+
210+ func TestAlert_Marshal (t * testing.T ) {
211+ testJSONMarshal (t , & Alert {}, "{}" )
212+
213+ u := & Alert {
214+ RuleID : String ("rid" ),
215+ RuleSeverity : String ("rs" ),
216+ RuleDescription : String ("rd" ),
217+ Tool : String ("t" ),
218+ CreatedAt : & Timestamp {referenceTime },
219+ Open : Bool (false ),
220+ ClosedBy : & User {
221+ Login : String ("l" ),
222+ ID : Int64 (1 ),
223+ NodeID : String ("n" ),
224+ URL : String ("u" ),
225+ ReposURL : String ("r" ),
226+ EventsURL : String ("e" ),
227+ AvatarURL : String ("a" ),
228+ },
229+ ClosedAt : & Timestamp {referenceTime },
230+ URL : String ("url" ),
231+ HTMLURL : String ("hurl" ),
232+ }
233+
234+ want := `{
235+ "rule_id": "rid",
236+ "rule_severity": "rs",
237+ "rule_description": "rd",
238+ "tool": "t",
239+ "created_at": ` + referenceTimeStr + `,
240+ "open": false,
241+ "closed_by": {
242+ "login": "l",
243+ "id": 1,
244+ "node_id": "n",
245+ "avatar_url": "a",
246+ "url": "u",
247+ "events_url": "e",
248+ "repos_url": "r"
249+ },
250+ "closed_at": ` + referenceTimeStr + `,
251+ "url": "url",
252+ "html_url": "hurl"
253+ }`
254+
255+ testJSONMarshal (t , u , want )
256+ }
You can’t perform that action at this time.
0 commit comments