MCPcopy Create free account
hub / github.com/cloudbase/garm / TestGithubConfig

Function TestGithubConfig

config/config_test.go:579–812  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

577}
578
579func TestGithubConfig(t *testing.T) {
580 cfg := getDefaultGithubConfig()
581
582 tests := []struct {
583 name string
584 cfg Github
585 errString string
586 }{
587 {
588 name: "Config is valid",
589 cfg: cfg[0],
590 errString: "",
591 },
592 {
593 name: "BaseURL is invalid",
594 cfg: Github{
595 Name: "dummy_creds",
596 Description: "dummy github credentials",
597 BaseURL: "bogus",
598 AuthType: GithubAuthTypePAT,
599 PAT: GithubPAT{
600 OAuth2Token: "bogus",
601 },
602 },
603 errString: "invalid base_url: parse.*",
604 },
605 {
606 name: "APIBaseURL is invalid",
607 cfg: Github{
608 Name: "dummy_creds",
609 Description: "dummy github credentials",
610 APIBaseURL: "bogus",
611 AuthType: GithubAuthTypePAT,
612 PAT: GithubPAT{
613 OAuth2Token: "bogus",
614 },
615 },
616 errString: "invalid api_base_url: parse.*",
617 },
618 {
619 name: "UploadBaseURL is invalid",
620 cfg: Github{
621 Name: "dummy_creds",
622 Description: "dummy github credentials",
623 UploadBaseURL: "bogus",
624 AuthType: GithubAuthTypePAT,
625 PAT: GithubPAT{
626 OAuth2Token: "bogus",
627 },
628 },
629 errString: "invalid upload_base_url: parse.*",
630 },
631 {
632 name: "BaseURL is set and is valid",
633 cfg: Github{
634 Name: "dummy_creds",
635 Description: "dummy github credentials",
636 BaseURL: "https://github.example.com/",

Callers

nothing calls this directly

Calls 4

getDefaultGithubConfigFunction · 0.85
RunMethod · 0.45
ValidateMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected