-
Jordan Wright committed 6 years ago1 parent 159ea126
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
-
skipped 35 lines 36 36 } 37 37 // Test that the variables used in the template 38 38 // validate with no issues 39 - td := struct { 40 - Result 41 - URL string 42 - TrackingURL string 43 - Tracker string 44 - From string 45 - }{ 46 - Result{ 47 - BaseRecipient: BaseRecipient{ 48 - Email: "[email protected]", 49 - FirstName: "Foo", 50 - LastName: "Bar", 51 - Position: "Test", 52 - }, 39 + vc := ValidationContext{ 40 + FromAddress: "[email protected]", 41 + BaseURL: "http://example.com", 42 + } 43 + td := Result{ 44 + BaseRecipient: BaseRecipient{ 45 + Email: "[email protected]", 46 + FirstName: "Foo", 47 + LastName: "Bar", 48 + Position: "Test", 53 49 }, 54 - "http://foo.bar", 55 - "http://foo.bar/track", 56 - "<img src='http://foo.bar/track", 57 - "John Doe <[email protected]>", 50 + RId: "123456", 51 + } 52 + ptx, err := NewPhishingTemplateContext(vc, td.BaseRecipient, td.RId) 53 + if err != nil { 54 + return err 58 55 } 59 - _, err := ExecuteTemplate(t.HTML, td) 56 + _, err = ExecuteTemplate(t.HTML, ptx) 60 57 if err != nil { 61 58 return err 62 59 } 63 - _, err = ExecuteTemplate(t.Text, td) 60 + _, err = ExecuteTemplate(t.Text, ptx) 64 61 if err != nil { 65 62 return err 66 63 } skipped 143 lines -