11//
22// DISCLAIMER
33//
4- // Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
4+ // Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
55//
66// Licensed under the Apache License, Version 2.0 (the "License");
77// you may not use this file except in compliance with the License.
@@ -30,18 +30,18 @@ import (
3030
3131func TestAuthenticationSpecValidate (t * testing.T ) {
3232 // Valid
33- assert .Nil (t , AuthenticationSpec {JWTSecretName : util .NewString ("None" )}.Validate (false ))
34- assert .Nil (t , AuthenticationSpec {JWTSecretName : util .NewString ("foo" )}.Validate (false ))
35- assert .Nil (t , AuthenticationSpec {JWTSecretName : util .NewString ("foo" )}.Validate (true ))
33+ assert .Nil (t , AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("None" )}.Validate (false ))
34+ assert .Nil (t , AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("foo" )}.Validate (false ))
35+ assert .Nil (t , AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("foo" )}.Validate (true ))
3636
3737 // Not valid
38- assert .Error (t , AuthenticationSpec {JWTSecretName : util .NewString ("Foo" )}.Validate (false ))
38+ assert .Error (t , AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("Foo" )}.Validate (false ))
3939}
4040
4141func TestAuthenticationSpecIsAuthenticated (t * testing.T ) {
42- assert .False (t , AuthenticationSpec {JWTSecretName : util .NewString ("None" )}.IsAuthenticated ())
43- assert .True (t , AuthenticationSpec {JWTSecretName : util .NewString ("foo" )}.IsAuthenticated ())
44- assert .True (t , AuthenticationSpec {JWTSecretName : util .NewString ("" )}.IsAuthenticated ())
42+ assert .False (t , AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("None" )}.IsAuthenticated ())
43+ assert .True (t , AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("foo" )}.IsAuthenticated ())
44+ assert .True (t , AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("" )}.IsAuthenticated ())
4545}
4646
4747func TestAuthenticationSpecSetDefaults (t * testing.T ) {
@@ -51,7 +51,7 @@ func TestAuthenticationSpecSetDefaults(t *testing.T) {
5151 }
5252
5353 assert .Equal (t , "test-jwt" , def (AuthenticationSpec {}).GetJWTSecretName ())
54- assert .Equal (t , "foo" , def (AuthenticationSpec {JWTSecretName : util .NewString ("foo" )}).GetJWTSecretName ())
54+ assert .Equal (t , "foo" , def (AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("foo" )}).GetJWTSecretName ())
5555}
5656
5757func TestAuthenticationSpecResetImmutableFields (t * testing.T ) {
@@ -63,35 +63,35 @@ func TestAuthenticationSpecResetImmutableFields(t *testing.T) {
6363 }{
6464 // Valid "changes"
6565 {
66- AuthenticationSpec {JWTSecretName : util .NewString ("None" )},
67- AuthenticationSpec {JWTSecretName : util .NewString ("None" )},
68- AuthenticationSpec {JWTSecretName : util .NewString ("None" )},
66+ AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("None" )},
67+ AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("None" )},
68+ AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("None" )},
6969 nil ,
7070 },
7171 {
72- AuthenticationSpec {JWTSecretName : util .NewString ("foo" )},
73- AuthenticationSpec {JWTSecretName : util .NewString ("foo" )},
74- AuthenticationSpec {JWTSecretName : util .NewString ("foo" )},
72+ AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("foo" )},
73+ AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("foo" )},
74+ AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("foo" )},
7575 nil ,
7676 },
7777 {
78- AuthenticationSpec {JWTSecretName : util .NewString ("foo" )},
79- AuthenticationSpec {JWTSecretName : util .NewString ("foo2" )},
80- AuthenticationSpec {JWTSecretName : util .NewString ("foo2" )},
78+ AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("foo" )},
79+ AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("foo2" )},
80+ AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("foo2" )},
8181 nil ,
8282 },
8383
8484 // Invalid changes
8585 {
86- AuthenticationSpec {JWTSecretName : util .NewString ("foo" )},
87- AuthenticationSpec {JWTSecretName : util .NewString ("None" )},
88- AuthenticationSpec {JWTSecretName : util .NewString ("foo" )},
86+ AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("foo" )},
87+ AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("None" )},
88+ AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("foo" )},
8989 []string {"test.jwtSecretName" },
9090 },
9191 {
92- AuthenticationSpec {JWTSecretName : util .NewString ("None" )},
93- AuthenticationSpec {JWTSecretName : util .NewString ("foo" )},
94- AuthenticationSpec {JWTSecretName : util .NewString ("None" )},
92+ AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("None" )},
93+ AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("foo" )},
94+ AuthenticationSpec {JWTSecretName : util.NewType [ string ] ("None" )},
9595 []string {"test.jwtSecretName" },
9696 },
9797 }
0 commit comments