Select Git revision
manager_client.go
action_url_test.go 1.79 KiB
package extension
import (
"fmt"
"net/url"
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewActionURL(t *testing.T) {
tests := []struct {
name string
action string
want *ActionURL
url string
wantErr assert.ErrorAssertionFunc
}{
{
name: "Without action",
want: &ActionURL{},
wantErr: assert.NoError,
},
{
name: "Without deprecated action call",
action: "build-site",
want: &ActionURL{
actionURL: "build-site",
},
url: "build-site",
wantErr: assert.NoError,
},
{
name: "With grpc action",
action: "grpc:///perxisweb/build-site",
want: &ActionURL{
actionURL: "grpc:///perxisweb/build-site",
actionID: "build-site",
extension: "perxisweb",
scheme: "grpc",
},
url: "grpc:///perxisweb/build-site",
wantErr: assert.NoError,
},
{
name: "With ui action",
action: "ui:///space/env/coll",
want: &ActionURL{
actionURL: "ui:///space/env/coll",
actionID: "",
extension: "",
scheme: "ui",
},
url: "ui:///space/env/coll",
wantErr: assert.NoError,
},
{
name: "With http action",
action: "https://perx.ru",
want: &ActionURL{
actionURL: "https://perx.ru",
scheme: "https",
},
url: "https://perx.ru",
wantErr: assert.NoError,
},
{
name: "With error in parse",
action: "grpc://user:abc{DEf1=ghi@example.com:5432/db?sslmode=require",
want: nil,