MCPcopy Index your code
hub / github.com/google/go-github / TestWithEnterpriseURLs

Function TestWithEnterpriseURLs

github/github_test.go:728–866  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

726}
727
728func TestWithEnterpriseURLs(t *testing.T) {
729 t.Parallel()
730 for _, tt := range []struct {
731 name string
732 baseURL string
733 wantBaseURL string
734 uploadURL string
735 wantUploadURL string
736 wantErr string
737 }{
738 {
739 name: "does_not_modify_properly_formed_urls",
740 baseURL: "https://custom-url/api/v3/",
741 wantBaseURL: "https://custom-url/api/v3/",
742 uploadURL: "https://custom-upload-url/api/uploads/",
743 wantUploadURL: "https://custom-upload-url/api/uploads/",
744 },
745 {
746 name: "adds_trailing_slash",
747 baseURL: "https://custom-url/api/v3",
748 wantBaseURL: "https://custom-url/api/v3/",
749 uploadURL: "https://custom-upload-url/api/uploads",
750 wantUploadURL: "https://custom-upload-url/api/uploads/",
751 },
752 {
753 name: "adds_enterprise_suffix",
754 baseURL: "https://custom-url/",
755 wantBaseURL: "https://custom-url/api/v3/",
756 uploadURL: "https://custom-upload-url/",
757 wantUploadURL: "https://custom-upload-url/api/uploads/",
758 },
759 {
760 name: "adds_enterprise_suffix_and_trailing_slash",
761 baseURL: "https://custom-url",
762 wantBaseURL: "https://custom-url/api/v3/",
763 uploadURL: "https://custom-upload-url",
764 wantUploadURL: "https://custom-upload-url/api/uploads/",
765 },
766 {
767 name: "url_has_existing_api_prefix_adds_trailing_slash",
768 baseURL: "https://api.custom-url",
769 wantBaseURL: "https://api.custom-url/",
770 uploadURL: "https://api.custom-upload-url",
771 wantUploadURL: "https://api.custom-upload-url/",
772 },
773 {
774 name: "url_has_existing_api_prefix_and_trailing_slash",
775 baseURL: "https://api.custom-url/",
776 wantBaseURL: "https://api.custom-url/",
777 uploadURL: "https://api.custom-upload-url/",
778 wantUploadURL: "https://api.custom-upload-url/",
779 },
780 {
781 name: "url_has_api_subdomain_adds_trailing_slash",
782 baseURL: "https://catalog.api.custom-url",
783 wantBaseURL: "https://catalog.api.custom-url/",
784 uploadURL: "https://catalog.api.custom-upload-url",
785 wantUploadURL: "https://catalog.api.custom-upload-url/",

Callers

nothing calls this directly

Calls 4

WithEnterpriseURLsFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…