@@ -11,8 +11,8 @@ import (
1111 "testing"
1212 "time"
1313
14- flagsmith "github.com/Flagsmith/flagsmith-go-client/v3 "
15- "github.com/Flagsmith/flagsmith-go-client/v3 /fixtures"
14+ flagsmith "github.com/Flagsmith/flagsmith-go-client/v4 "
15+ "github.com/Flagsmith/flagsmith-go-client/v4 /fixtures"
1616 "github.com/stretchr/testify/assert"
1717)
1818
@@ -204,6 +204,8 @@ func TestGetFlags(t *testing.T) {
204204
205205func TestGetFlagsTransientIdentity (t * testing.T ) {
206206 // Given
207+ identifier := "transient"
208+ transient := true
207209 ctx := context .Background ()
208210 expectedRequestBody := `{"identifier":"transient","transient":true}`
209211 server := getTestHttpServer (t , "/api/v1/identities/" , fixtures .EnvironmentAPIKey , & expectedRequestBody , fixtures .IdentityResponseJson )
@@ -212,7 +214,7 @@ func TestGetFlagsTransientIdentity(t *testing.T) {
212214 // When
213215 client := flagsmith .NewClient (fixtures .EnvironmentAPIKey , flagsmith .WithBaseURL (server .URL + "/api/v1/" ))
214216
215- flags , err := client .GetFlags (ctx , & flagsmith.EvaluationContext {Identity : & flagsmith.IdentityEvaluationContext {Identifier : "transient" , Transient : true }})
217+ flags , err := client .GetFlags (ctx , & flagsmith.EvaluationContext {Identity : & flagsmith.IdentityEvaluationContext {Identifier : & identifier , Transient : & transient }})
216218
217219 // Then
218220 assert .NoError (t , err )
@@ -228,11 +230,13 @@ func TestGetFlagsTransientIdentity(t *testing.T) {
228230
229231func TestGetFlagsTransientTraits (t * testing.T ) {
230232 // Given
233+ identifier := "test_identity"
234+ transient := true
231235 ctx := context .Background ()
232236 expectedRequestBody := `{"identifier":"test_identity","traits":` +
233237 `[{"trait_key":"NullTrait","trait_value":null},` +
234238 `{"trait_key":"StringTrait","trait_value":"value"},` +
235- `{"trait_key":"TransientTrait","trait_value":"value","transient":true}],"transient":false }`
239+ `{"trait_key":"TransientTrait","trait_value":"value","transient":true}]}`
236240 server := getTestHttpServer (t , "/api/v1/identities/" , fixtures .EnvironmentAPIKey , & expectedRequestBody , fixtures .IdentityResponseJson )
237241 defer server .Close ()
238242
@@ -243,13 +247,13 @@ func TestGetFlagsTransientTraits(t *testing.T) {
243247 ctx ,
244248 & flagsmith.EvaluationContext {
245249 Identity : & flagsmith.IdentityEvaluationContext {
246- Identifier : "test_identity" ,
250+ Identifier : & identifier ,
247251 Traits : map [string ]* flagsmith.TraitEvaluationContext {
248252 "NullTrait" : nil ,
249253 "StringTrait" : {Value : "value" },
250254 "TransientTrait" : {
251255 Value : "value" ,
252- Transient : true ,
256+ Transient : & transient ,
253257 },
254258 },
255259 },
@@ -289,6 +293,7 @@ func TestGetFlagsEnvironmentEvaluationContextFlags(t *testing.T) {
289293
290294func TestGetFlagsEnvironmentEvaluationContextIdentity (t * testing.T ) {
291295 // Given
296+ identifier := "test_identity"
292297 ctx := context .Background ()
293298 expectedEnvKey := "different"
294299 server := getTestHttpServer (t , "/api/v1/identities/" , expectedEnvKey , nil , fixtures .IdentityResponseJson )
@@ -301,7 +306,7 @@ func TestGetFlagsEnvironmentEvaluationContextIdentity(t *testing.T) {
301306 ctx ,
302307 & flagsmith.EvaluationContext {
303308 Environment : & flagsmith.EnvironmentEvaluationContext {APIKey : expectedEnvKey },
304- Identity : & flagsmith.IdentityEvaluationContext {Identifier : "test_identity" },
309+ Identity : & flagsmith.IdentityEvaluationContext {Identifier : & identifier },
305310 })
306311
307312 // Then
0 commit comments