(t *testing.T)
| 1889 | } |
| 1890 | |
| 1891 | func TestNewUploadRequest_errorForNoTrailingSlash(t *testing.T) { |
| 1892 | t.Parallel() |
| 1893 | tests := []struct { |
| 1894 | rawurl string |
| 1895 | wantError bool |
| 1896 | }{ |
| 1897 | {rawurl: "https://example.com/api/uploads", wantError: true}, |
| 1898 | {rawurl: "https://example.com/api/uploads/", wantError: false}, |
| 1899 | } |
| 1900 | c := mustNewClient(t) |
| 1901 | for _, test := range tests { |
| 1902 | u, err := url.Parse(test.rawurl) |
| 1903 | if err != nil { |
| 1904 | t.Fatalf("url.Parse returned unexpected error: %v.", err) |
| 1905 | } |
| 1906 | c.uploadURL = u |
| 1907 | if _, err = c.NewUploadRequest(t.Context(), "test", nil, 0, ""); test.wantError && err == nil { |
| 1908 | t.Fatal("Expected error to be returned.") |
| 1909 | } else if !test.wantError && err != nil { |
| 1910 | t.Fatalf("NewUploadRequest returned unexpected error: %v.", err) |
| 1911 | } |
| 1912 | } |
| 1913 | } |
| 1914 | |
| 1915 | func TestResponse_populatePageValues(t *testing.T) { |
| 1916 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…