rename public_key in public_keys

remove compatibility layer to convert public keys newline delimited
in json list
This commit is contained in:
Nicola Murino
2019-08-07 23:41:10 +02:00
parent 5ad222fc53
commit 2aca4479a5
15 changed files with 61 additions and 49 deletions

View File

@@ -499,7 +499,7 @@ func TestHomeSpecialChars(t *testing.T) {
func TestLogin(t *testing.T) {
u := getTestUser(false)
u.PublicKey = []string{testPubKey}
u.PublicKeys = []string{testPubKey}
user, _, err := api.AddUser(u, http.StatusOK)
if err != nil {
t.Errorf("unable to add user: %v", err)
@@ -531,7 +531,7 @@ func TestLogin(t *testing.T) {
defer client.Close()
}
// testPubKey1 is not authorized
user.PublicKey = []string{testPubKey1}
user.PublicKeys = []string{testPubKey1}
user.Password = ""
_, _, err = api.UpdateUser(user, http.StatusOK)
if err != nil {
@@ -543,7 +543,7 @@ func TestLogin(t *testing.T) {
defer client.Close()
}
// login a user with multiple public keys, only the second one is valid
user.PublicKey = []string{testPubKey1, testPubKey}
user.PublicKeys = []string{testPubKey1, testPubKey}
user.Password = ""
_, _, err = api.UpdateUser(user, http.StatusOK)
if err != nil {
@@ -572,7 +572,7 @@ func TestLoginAfterUserUpdateEmptyPwd(t *testing.T) {
t.Errorf("unable to add user: %v", err)
}
user.Password = ""
user.PublicKey = []string{}
user.PublicKeys = []string{}
// password and public key should remain unchanged
_, _, err = api.UpdateUser(user, http.StatusOK)
if err != nil {
@@ -605,7 +605,7 @@ func TestLoginAfterUserUpdateEmptyPubKey(t *testing.T) {
t.Errorf("unable to add user: %v", err)
}
user.Password = ""
user.PublicKey = []string{}
user.PublicKeys = []string{}
// password and public key should remain unchanged
_, _, err = api.UpdateUser(user, http.StatusOK)
if err != nil {
@@ -1287,7 +1287,7 @@ func getTestUser(usePubKey bool) dataprovider.User {
Permissions: allPerms,
}
if usePubKey {
user.PublicKey = []string{testPubKey}
user.PublicKeys = []string{testPubKey}
user.Password = ""
}
return user