Skip to content

Commit

Permalink
fixed test for header value type
Browse files Browse the repository at this point in the history
  • Loading branch information
Sumeet Rai committed Nov 14, 2024
1 parent 50f3c8e commit 2ede298
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions plugins/internal/tengoutil/secure_script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,28 +96,6 @@ func TestNewSecureScript(t *testing.T) {
assert.Contains(t, err.Error(), "unsupported protocol scheme")
})

t.Run("HTTP GET with valid header value type (int)", func(t *testing.T) {
s, err := NewSecureScript(([]byte)(heredoc.Doc(`
http := import("http")
headers := { "User-Agent": 12345 }
http.get("http://example.com", headers)
`)), nil)
assert.NoError(t, err)

_, err = s.Compile()
assert.NoError(t, err)

result, err := s.Run()
assert.NoError(t, err)

resultMap, ok := result.(*tengo.Map)
assert.True(t, ok)

userAgent, ok := resultMap.Value["User-Agent"].(*tengo.String)
assert.True(t, ok)
assert.Equal(t, "12345", userAgent.Value)
})

t.Run("HTTP GET with timeout", func(t *testing.T) {
s, err := NewSecureScript(([]byte)(heredoc.Doc(`
http := import("http")
Expand Down

0 comments on commit 2ede298

Please sign in to comment.