MCPcopy Create free account
hub / github.com/conforma/cli / TestSourceIsHttp

Function TestSourceIsHttp

internal/policy/source/git_config_test.go:200–280  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

198}
199
200func TestSourceIsHttp(t *testing.T) {
201 tests := []struct {
202 name string
203 src string
204 expected bool
205 }{
206 // HTTP/HTTPS URLs that should be detected
207 {
208 name: "https url is detected as http",
209 src: "https://raw.githubusercontent.com/foo/bar",
210 expected: true,
211 },
212 {
213 name: "http url is detected as http",
214 src: "http://example.com/file.yaml",
215 expected: true,
216 },
217 {
218 name: "https with simple path is detected as http",
219 src: "https://example.com/config.yaml",
220 expected: true,
221 },
222
223 // Non-HTTP URLs that should not be detected
224 {
225 name: "git protocol url is not detected as http",
226 src: "git::https://foo.bar/asdf",
227 expected: false,
228 },
229 {
230 name: "git repository without protocol is not detected as http",
231 src: "git::github.com/foo/bar",
232 expected: false,
233 },
234 {
235 name: "github repository path is not detected as http",
236 src: "github.com/foo/bar",
237 expected: false,
238 },
239 {
240 name: "gitlab repository path is not detected as http",
241 src: "gitlab.com/foo/bar",
242 expected: false,
243 },
244 {
245 name: "s3 protocol url is not detected as http",
246 src: "s3::github.com/foo/bar",
247 expected: false,
248 },
249 {
250 name: "raw github without protocol is not detected as http",
251 src: "raw.githubusercontent.com/foo/bar",
252 expected: false,
253 },
254
255 // Edge cases
256 {
257 name: "empty string is not detected as http",

Callers

nothing calls this directly

Calls 2

SourceIsHttpFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected