authorizer/server/utils/urls_test.go

27 lines
578 B
Go
Raw Normal View History

package utils
2021-12-20 12:03:11 +00:00
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestGetHostName(t *testing.T) {
authorizer_url := "http://test.herokuapp.com:80"
host, port := GetHostParts(authorizer_url)
expectedHost := "test.herokuapp.com"
assert.Equal(t, host, expectedHost, "hostname should be equal")
assert.Equal(t, port, "80", "port should be 80")
}
func TestGetDomainName(t *testing.T) {
authorizer_url := "http://test.herokuapp.com"
got := GetDomainName(authorizer_url)
want := "herokuapp.com"
2021-12-20 12:03:11 +00:00
assert.Equal(t, got, want, "domain name should be equal")
}