Support for special characters and remove buggy functions (#1977)
- remove the use of encodeURI and encodeURIComponent functions and instead use encodeFileName and decodeFileName functions - support for users with special characters - support for users with special characters - support for users with special characters - fixed incorrectly group list display for policies Signed-off-by: Lenin Alevski <alevsk.8772@gmail.com>
This commit is contained in:
@@ -18,6 +18,7 @@ package integration
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
@@ -113,7 +114,7 @@ func Test_GetGroupAPI(t *testing.T) {
|
||||
{
|
||||
name: "Get Group - Valid",
|
||||
args: args{
|
||||
api: "?name=getgroup1",
|
||||
api: base64.StdEncoding.EncodeToString([]byte("getgroup1")),
|
||||
},
|
||||
expectedStatus: 200,
|
||||
expectedError: nil,
|
||||
@@ -121,7 +122,7 @@ func Test_GetGroupAPI(t *testing.T) {
|
||||
{
|
||||
name: "Get Group - Invalid",
|
||||
args: args{
|
||||
api: "?name=askfjalkd",
|
||||
api: base64.StdEncoding.EncodeToString([]byte("askfjalkd")),
|
||||
},
|
||||
expectedStatus: 500,
|
||||
expectedError: nil,
|
||||
@@ -139,7 +140,7 @@ func Test_GetGroupAPI(t *testing.T) {
|
||||
requestDataJSON, _ := json.Marshal(requestDataPolicy)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"GET", fmt.Sprintf("http://localhost:9090/api/v1/group%s", tt.args.api), requestDataBody)
|
||||
"GET", fmt.Sprintf("http://localhost:9090/api/v1/group/%s", tt.args.api), requestDataBody)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
@@ -223,7 +224,7 @@ func Test_PutGroupsAPI(t *testing.T) {
|
||||
{
|
||||
name: "Put Group - Valid",
|
||||
args: args{
|
||||
api: "?name=putgroup1",
|
||||
api: base64.StdEncoding.EncodeToString([]byte("putgroup1")),
|
||||
members: []string{"member3"},
|
||||
status: "enabled",
|
||||
},
|
||||
@@ -233,7 +234,7 @@ func Test_PutGroupsAPI(t *testing.T) {
|
||||
{
|
||||
name: "Put Group - Invalid",
|
||||
args: args{
|
||||
api: "?name=gdgfdfgd",
|
||||
api: base64.StdEncoding.EncodeToString([]byte("gdgfdfgd")),
|
||||
members: []string{"member3"},
|
||||
status: "enabled",
|
||||
},
|
||||
@@ -256,7 +257,7 @@ func Test_PutGroupsAPI(t *testing.T) {
|
||||
requestDataJSON, _ := json.Marshal(requestDataPolicy)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"PUT", fmt.Sprintf("http://localhost:9090/api/v1/group%s", tt.args.api), requestDataBody)
|
||||
"PUT", fmt.Sprintf("http://localhost:9090/api/v1/group/%s", tt.args.api), requestDataBody)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
@@ -293,7 +294,7 @@ func Test_DeleteGroupAPI(t *testing.T) {
|
||||
{
|
||||
name: "Delete Group - Valid",
|
||||
args: args{
|
||||
api: "?name=grouptests1",
|
||||
api: base64.StdEncoding.EncodeToString([]byte("grouptests1")),
|
||||
},
|
||||
verb: "DELETE",
|
||||
expectedStatus: 204,
|
||||
@@ -302,7 +303,7 @@ func Test_DeleteGroupAPI(t *testing.T) {
|
||||
{
|
||||
name: "Delete Group - Invalid",
|
||||
args: args{
|
||||
api: "?name=grouptests12345",
|
||||
api: base64.StdEncoding.EncodeToString([]byte("grouptests12345")),
|
||||
},
|
||||
verb: "DELETE",
|
||||
expectedStatus: 404,
|
||||
@@ -311,7 +312,7 @@ func Test_DeleteGroupAPI(t *testing.T) {
|
||||
{
|
||||
name: "Access Group After Delete - Invalid",
|
||||
args: args{
|
||||
api: "?name=grouptests1",
|
||||
api: base64.StdEncoding.EncodeToString([]byte("grouptests1")),
|
||||
},
|
||||
verb: "GET",
|
||||
expectedStatus: 500,
|
||||
@@ -330,7 +331,7 @@ func Test_DeleteGroupAPI(t *testing.T) {
|
||||
requestDataJSON, _ := json.Marshal(requestDataPolicy)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
tt.verb, fmt.Sprintf("http://localhost:9090/api/v1/group%s", tt.args.api), requestDataBody)
|
||||
tt.verb, fmt.Sprintf("http://localhost:9090/api/v1/group/%s", tt.args.api), requestDataBody)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user