github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/util/url_test.go (about) 1 package util_test 2 3 import ( 4 . "code.cloudfoundry.org/cli/util" 5 . "github.com/onsi/ginkgo" 6 . "github.com/onsi/ginkgo/extensions/table" 7 . "github.com/onsi/gomega" 8 ) 9 10 var _ = Describe("util", func() { 11 12 DescribeTable("URL's", 13 func(path string, isHTTPScheme bool) { 14 Expect(IsHTTPScheme(path)).To(Equal(isHTTPScheme)) 15 }, 16 17 Entry("proper HTTP URL", "http://example.com", true), 18 Entry("proper HTTPS URL", "https://example.com", true), 19 Entry("not proper HTTP URL", "http//example.com", false), 20 Entry("proper FTP URL", "ftp://example.com", false), 21 Entry("local file name", "some-path", false), 22 Entry("UNIX path", "/some/path", false), 23 Entry("Windows path", `C:\some\path`, false), 24 ) 25 26 DescribeTable("IsUnsupportedScheme", 27 func(path string, isUnsupportedScheme bool) { 28 Expect(IsUnsupportedURLScheme(path)).To(Equal(isUnsupportedScheme)) 29 }, 30 31 Entry("proper HTTP URL", "http://example.com", false), 32 Entry("proper HTTPS URL", "https://example.com", false), 33 Entry("not proper HTTP URL", "http//example.com", false), 34 Entry("proper FTP URL", "ftp://example.com", true), 35 Entry("local file name", "some-path", false), 36 Entry("UNIX path", "/some/path", false), 37 Entry("Windows path", `C:\some\path`, false), 38 ) 39 })