MCPcopy Index your code
hub / github.com/gavv/httpexpect / TestEnvironment_NotFound

Function TestEnvironment_NotFound

environment_test.go:117–173  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

115}
116
117func TestEnvironment_NotFound(t *testing.T) {
118 t.Run("Get", func(t *testing.T) {
119 env := newEnvironment(newMockChain(t))
120
121 assert.Nil(t, env.Get("bad_key"))
122 env.chain.assert(t, failure)
123 })
124
125 t.Run("GetBool", func(t *testing.T) {
126 env := newEnvironment(newMockChain(t))
127
128 assert.Zero(t, env.GetInt("bad_key"))
129 env.chain.assert(t, failure)
130 })
131
132 t.Run("GetInt", func(t *testing.T) {
133 env := newEnvironment(newMockChain(t))
134
135 assert.Zero(t, env.GetInt("bad_key"))
136 env.chain.assert(t, failure)
137 })
138
139 t.Run("GetFloat", func(t *testing.T) {
140 env := newEnvironment(newMockChain(t))
141
142 assert.Zero(t, env.GetFloat("bad_key"))
143 env.chain.assert(t, failure)
144 })
145
146 t.Run("GetString", func(t *testing.T) {
147 env := newEnvironment(newMockChain(t))
148
149 assert.Zero(t, env.GetString("bad_key"))
150 env.chain.assert(t, failure)
151 })
152
153 t.Run("GetBytes", func(t *testing.T) {
154 env := newEnvironment(newMockChain(t))
155
156 assert.Nil(t, env.GetBytes("bad_key"))
157 env.chain.assert(t, failure)
158 })
159
160 t.Run("GetDuration", func(t *testing.T) {
161 env := newEnvironment(newMockChain(t))
162
163 assert.Zero(t, env.GetDuration("bad_key"))
164 env.chain.assert(t, failure)
165 })
166
167 t.Run("GetTime", func(t *testing.T) {
168 env := newEnvironment(newMockChain(t))
169
170 assert.Equal(t, time.Unix(0, 0), env.GetTime("bad_key"))
171 env.chain.assert(t, failure)
172 })
173}
174

Callers

nothing calls this directly

Calls 11

newEnvironmentFunction · 0.85
newMockChainFunction · 0.85
GetMethod · 0.80
assertMethod · 0.80
GetIntMethod · 0.80
GetFloatMethod · 0.80
GetStringMethod · 0.80
GetBytesMethod · 0.80
GetDurationMethod · 0.80
GetTimeMethod · 0.80
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…