@@ -3,8 +3,6 @@ package templating_test
33import (
44 "testing"
55
6- "github.com/SpectoLabs/hoverfly/core/journal"
7-
86 "github.com/SpectoLabs/hoverfly/core/models"
97 "github.com/SpectoLabs/hoverfly/core/templating"
108 . "github.com/onsi/gomega"
@@ -297,7 +295,7 @@ func Test_ShouldCreateTemplatingDataPathsFromRequest(t *testing.T) {
297295 Scheme : "http" ,
298296 Destination : "test.com" ,
299297 Path : "/foo/bar" ,
300- }, nil , & models.Literals {}, & models.Variables {}, make (map [string ]string ), & journal. Journal {} )
298+ }, & models.Literals {}, & models.Variables {}, make (map [string ]string ))
301299
302300 Expect (actual .Request .Path ).To (ConsistOf ("foo" , "bar" ))
303301}
@@ -308,7 +306,7 @@ func Test_ShouldCreateTemplatingDataPathsFromRequestWithNoPaths(t *testing.T) {
308306 actual := templating .NewTemplator ().NewTemplatingData (& models.RequestDetails {
309307 Scheme : "http" ,
310308 Destination : "test.com" ,
311- }, nil , & models.Literals {}, & models.Variables {}, make (map [string ]string ), & journal. Journal {} )
309+ }, & models.Literals {}, & models.Variables {}, make (map [string ]string ))
312310
313311 Expect (actual .Request .Path ).To (BeEmpty ())
314312}
@@ -323,7 +321,7 @@ func Test_ShouldCreateTemplatingDataQueryParamsFromRequest(t *testing.T) {
323321 "cheese" : {"1" , "3" },
324322 "ham" : {"2" },
325323 },
326- }, nil , & models.Literals {}, & models.Variables {}, make (map [string ]string ), & journal. Journal {} )
324+ }, & models.Literals {}, & models.Variables {}, make (map [string ]string ))
327325
328326 Expect (actual .Request .QueryParam ).To (HaveKeyWithValue ("cheese" , []string {"1" , "3" }))
329327 Expect (actual .Request .QueryParam ).To (HaveKeyWithValue ("ham" , []string {"2" }))
@@ -336,7 +334,7 @@ func Test_ShouldCreateTemplatingDataQueryParamsFromRequestWithNoQueryParams(t *t
336334 actual := templating .NewTemplator ().NewTemplatingData (& models.RequestDetails {
337335 Scheme : "http" ,
338336 Destination : "test.com" ,
339- }, nil , & models.Literals {}, & models.Variables {}, make (map [string ]string ), & journal. Journal {} )
337+ }, & models.Literals {}, & models.Variables {}, make (map [string ]string ))
340338
341339 Expect (actual .Request .QueryParam ).To (BeEmpty ())
342340}
@@ -347,7 +345,7 @@ func Test_ShouldCreateTemplatingDataHttpScheme(t *testing.T) {
347345 actual := templating .NewTemplator ().NewTemplatingData (& models.RequestDetails {
348346 Scheme : "http" ,
349347 Destination : "test.com" ,
350- }, nil , & models.Literals {}, & models.Variables {}, make (map [string ]string ), & journal. Journal {} )
348+ }, & models.Literals {}, & models.Variables {}, make (map [string ]string ))
351349
352350 Expect (actual .Request .Scheme ).To (Equal ("http" ))
353351}
@@ -362,7 +360,7 @@ func Test_ShouldCreateTemplatingDataHeaderFromRequest(t *testing.T) {
362360 "cheese" : {"1" , "3" },
363361 "ham" : {"2" },
364362 },
365- }, nil , & models.Literals {}, & models.Variables {}, make (map [string ]string ), & journal. Journal {} )
363+ }, & models.Literals {}, & models.Variables {}, make (map [string ]string ))
366364
367365 Expect (actual .Request .Header ).To (HaveKeyWithValue ("cheese" , []string {"1" , "3" }))
368366 Expect (actual .Request .Header ).To (HaveKeyWithValue ("ham" , []string {"2" }))
@@ -375,7 +373,7 @@ func Test_ShouldCreateTemplatingDataHeaderFromRequestWithNoHeader(t *testing.T)
375373 actual := templating .NewTemplator ().NewTemplatingData (& models.RequestDetails {
376374 Scheme : "http" ,
377375 Destination : "test.com" ,
378- }, nil , & models.Literals {}, & models.Variables {}, make (map [string ]string ), & journal. Journal {} )
376+ }, & models.Literals {}, & models.Variables {}, make (map [string ]string ))
379377
380378 Expect (actual .Request .Header ).To (BeEmpty ())
381379}
@@ -702,7 +700,7 @@ func Test_VarSetToNilInCaseOfInvalidArgsPassed(t *testing.T) {
702700 actual := templator .NewTemplatingData (& models.RequestDetails {
703701 Scheme : "http" ,
704702 Destination : "test.com" ,
705- }, nil , & models.Literals {}, vars , make (map [string ]string ), & journal. Journal {} )
703+ }, & models.Literals {}, vars , make (map [string ]string ))
706704
707705 Expect (actual .Vars ["varOne" ]).To (BeNil ())
708706
@@ -722,7 +720,7 @@ func Test_VarSetToProperValueInCaseOfRequestDetailsPassedAsArgument(t *testing.T
722720
723721 actual := templator .NewTemplatingData (& models.RequestDetails {
724722 Path : "/part1/foo,bar" ,
725- }, nil , & models.Literals {}, vars , make (map [string ]string ), & journal. Journal {} )
723+ }, & models.Literals {}, vars , make (map [string ]string ))
726724
727725 Expect (actual .Vars ["splitRequestPath" ]).ToNot (BeNil ())
728726 Expect (len (actual .Vars ["splitRequestPath" ].([]string ))).To (Equal (2 ))
@@ -823,13 +821,13 @@ func Test_ApplyTemplate_Arithmetic_Ops_With_Each_Block(t *testing.T) {
823821
824822 template , _ := templator .ParseTemplate (responseBody )
825823 state := make (map [string ]string )
826- result , err := templator .RenderTemplate (template , requestDetails , nil , & models.Literals {}, & models.Variables {}, state , & journal. Journal {} )
824+ result , err := templator .RenderTemplate (template , requestDetails , nil , & models.Literals {}, & models.Variables {}, state )
827825
828826 Expect (err ).To (BeNil ())
829827 Expect (result ).To (Equal (` 3.5 9 total: 12.50` ))
830828
831829 // Running the second time should produce the same result because each execution has its own context data.
832- result , err = templator .RenderTemplate (template , requestDetails , nil , & models.Literals {}, & models.Variables {}, state , & journal. Journal {} )
830+ result , err = templator .RenderTemplate (template , requestDetails , nil , & models.Literals {}, & models.Variables {}, state )
833831 Expect (err ).To (BeNil ())
834832 Expect (result ).To (Equal (` 3.5 9 total: 12.50` ))
835833}
@@ -867,7 +865,7 @@ func Test_ApplyTemplate_setStatusCode(t *testing.T) {
867865 Expect (err ).To (BeNil ())
868866
869867 response := & models.ResponseDetails {}
870- result , err := templator .RenderTemplate (template , & models.RequestDetails {}, response , & models.Literals {}, & models.Variables {}, make (map [string ]string ), & journal. Journal {} )
868+ result , err := templator .RenderTemplate (template , & models.RequestDetails {}, response , & models.Literals {}, & models.Variables {}, make (map [string ]string ))
871869
872870 Expect (err ).To (BeNil ())
873871 Expect (result ).To (Equal ("" ))
@@ -883,7 +881,7 @@ func Test_ApplyTemplate_setStatusCode_should_ignore_invalid_code(t *testing.T) {
883881 Expect (err ).To (BeNil ())
884882
885883 response := & models.ResponseDetails {}
886- result , err := templator .RenderTemplate (template , & models.RequestDetails {}, response , & models.Literals {}, & models.Variables {}, make (map [string ]string ), & journal. Journal {} )
884+ result , err := templator .RenderTemplate (template , & models.RequestDetails {}, response , & models.Literals {}, & models.Variables {}, make (map [string ]string ))
887885
888886 Expect (err ).To (BeNil ())
889887 Expect (result ).To (Equal ("" ))
@@ -920,7 +918,7 @@ func ApplyTemplate(requestDetails *models.RequestDetails, state map[string]strin
920918func renderTemplate (requestDetails * models.RequestDetails , state map [string ]string , responseBody string , templator * templating.Templator ) (string , error ) {
921919 template , err := templator .ParseTemplate (responseBody )
922920 Expect (err ).To (BeNil ())
923- return templator .RenderTemplate (template , requestDetails , nil , & models.Literals {}, & models.Variables {}, state , & journal. Journal {} )
921+ return templator .RenderTemplate (template , requestDetails , nil , & models.Literals {}, & models.Variables {}, state )
924922}
925923
926924func initiateTemplator () * templating.Templator {
0 commit comments