MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / TestParseURI_BasicS3

Function TestParseURI_BasicS3

pkg/remote/connparse/connparse_test.go:419–446  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

417}
418
419func TestParseURI_BasicS3(t *testing.T) {
420 t.Parallel()
421 cstr := "profile:s3://bucket/path/to/file"
422 c, err := connparse.ParseURI(cstr)
423 if err != nil {
424 t.Fatalf("failed to parse URI: %v", err)
425 }
426 expected := "path/to/file"
427 if c.Path != expected {
428 t.Fatalf("expected path to be \"%q\", got \"%q\"", expected, c.Path)
429 }
430 expected = "bucket"
431 if c.Host != expected {
432 t.Fatalf("expected host to be \"%q\", got \"%q\"", expected, c.Host)
433 }
434 expected = "bucket/path/to/file"
435 pathWithHost := c.GetPathWithHost()
436 if pathWithHost != expected {
437 t.Fatalf("expected path with host to be \"%q\", got \"%q\"", expected, pathWithHost)
438 }
439 expected = "s3"
440 if c.GetType() != expected {
441 t.Fatalf("expected conn type to be \"%q\", got \"%q\"", expected, c.GetType())
442 }
443 if len(c.GetSchemeParts()) != 2 {
444 t.Fatalf("expected scheme parts to be 2, got %d", len(c.GetSchemeParts()))
445 }
446}
447
448func TestParseURI_S3BucketOnly(t *testing.T) {
449 t.Parallel()

Callers

nothing calls this directly

Calls 4

ParseURIFunction · 0.92
GetPathWithHostMethod · 0.80
GetTypeMethod · 0.80
GetSchemePartsMethod · 0.80

Tested by

no test coverage detected