mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-30 21:22:25 -05:00 
			
		
		
		
	[chore]: Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 (#2714)
* [chore]: Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.4 to 1.9.0. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](https://github.com/stretchr/testify/compare/v1.8.4...v1.9.0) --- updated-dependencies: - dependency-name: github.com/stretchr/testify dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * cast the exxpected test values as float32 to bypass (possible) testify suite regression --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: kim <grufwub@gmail.com>
This commit is contained in:
		
					parent
					
						
							
								d85727e184
							
						
					
				
			
			
				commit
				
					
						7bc536d1f7
					
				
			
		
					 14 changed files with 351 additions and 216 deletions
				
			
		
							
								
								
									
										27
									
								
								vendor/github.com/stretchr/testify/assert/http_assertions.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										27
									
								
								vendor/github.com/stretchr/testify/assert/http_assertions.go
									
										
									
										generated
									
									
										vendored
									
									
								
							|  | @ -12,7 +12,7 @@ import ( | |||
| // an error if building a new request fails. | ||||
| func httpCode(handler http.HandlerFunc, method, url string, values url.Values) (int, error) { | ||||
| 	w := httptest.NewRecorder() | ||||
| 	req, err := http.NewRequest(method, url, nil) | ||||
| 	req, err := http.NewRequest(method, url, http.NoBody) | ||||
| 	if err != nil { | ||||
| 		return -1, err | ||||
| 	} | ||||
|  | @ -32,12 +32,12 @@ func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, value | |||
| 	} | ||||
| 	code, err := httpCode(handler, method, url, values) | ||||
| 	if err != nil { | ||||
| 		Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) | ||||
| 		Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...) | ||||
| 	} | ||||
| 
 | ||||
| 	isSuccessCode := code >= http.StatusOK && code <= http.StatusPartialContent | ||||
| 	if !isSuccessCode { | ||||
| 		Fail(t, fmt.Sprintf("Expected HTTP success status code for %q but received %d", url+"?"+values.Encode(), code)) | ||||
| 		Fail(t, fmt.Sprintf("Expected HTTP success status code for %q but received %d", url+"?"+values.Encode(), code), msgAndArgs...) | ||||
| 	} | ||||
| 
 | ||||
| 	return isSuccessCode | ||||
|  | @ -54,12 +54,12 @@ func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, valu | |||
| 	} | ||||
| 	code, err := httpCode(handler, method, url, values) | ||||
| 	if err != nil { | ||||
| 		Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) | ||||
| 		Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...) | ||||
| 	} | ||||
| 
 | ||||
| 	isRedirectCode := code >= http.StatusMultipleChoices && code <= http.StatusTemporaryRedirect | ||||
| 	if !isRedirectCode { | ||||
| 		Fail(t, fmt.Sprintf("Expected HTTP redirect status code for %q but received %d", url+"?"+values.Encode(), code)) | ||||
| 		Fail(t, fmt.Sprintf("Expected HTTP redirect status code for %q but received %d", url+"?"+values.Encode(), code), msgAndArgs...) | ||||
| 	} | ||||
| 
 | ||||
| 	return isRedirectCode | ||||
|  | @ -76,12 +76,12 @@ func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values | |||
| 	} | ||||
| 	code, err := httpCode(handler, method, url, values) | ||||
| 	if err != nil { | ||||
| 		Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) | ||||
| 		Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...) | ||||
| 	} | ||||
| 
 | ||||
| 	isErrorCode := code >= http.StatusBadRequest | ||||
| 	if !isErrorCode { | ||||
| 		Fail(t, fmt.Sprintf("Expected HTTP error status code for %q but received %d", url+"?"+values.Encode(), code)) | ||||
| 		Fail(t, fmt.Sprintf("Expected HTTP error status code for %q but received %d", url+"?"+values.Encode(), code), msgAndArgs...) | ||||
| 	} | ||||
| 
 | ||||
| 	return isErrorCode | ||||
|  | @ -98,12 +98,12 @@ func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method, url string, va | |||
| 	} | ||||
| 	code, err := httpCode(handler, method, url, values) | ||||
| 	if err != nil { | ||||
| 		Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) | ||||
| 		Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...) | ||||
| 	} | ||||
| 
 | ||||
| 	successful := code == statuscode | ||||
| 	if !successful { | ||||
| 		Fail(t, fmt.Sprintf("Expected HTTP status code %d for %q but received %d", statuscode, url+"?"+values.Encode(), code)) | ||||
| 		Fail(t, fmt.Sprintf("Expected HTTP status code %d for %q but received %d", statuscode, url+"?"+values.Encode(), code), msgAndArgs...) | ||||
| 	} | ||||
| 
 | ||||
| 	return successful | ||||
|  | @ -113,7 +113,10 @@ func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method, url string, va | |||
| // empty string if building a new request fails. | ||||
| func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string { | ||||
| 	w := httptest.NewRecorder() | ||||
| 	req, err := http.NewRequest(method, url+"?"+values.Encode(), nil) | ||||
| 	if len(values) > 0 { | ||||
| 		url += "?" + values.Encode() | ||||
| 	} | ||||
| 	req, err := http.NewRequest(method, url, http.NoBody) | ||||
| 	if err != nil { | ||||
| 		return "" | ||||
| 	} | ||||
|  | @ -135,7 +138,7 @@ func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, | |||
| 
 | ||||
| 	contains := strings.Contains(body, fmt.Sprint(str)) | ||||
| 	if !contains { | ||||
| 		Fail(t, fmt.Sprintf("Expected response body for \"%s\" to contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body)) | ||||
| 		Fail(t, fmt.Sprintf("Expected response body for \"%s\" to contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body), msgAndArgs...) | ||||
| 	} | ||||
| 
 | ||||
| 	return contains | ||||
|  | @ -155,7 +158,7 @@ func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url strin | |||
| 
 | ||||
| 	contains := strings.Contains(body, fmt.Sprint(str)) | ||||
| 	if contains { | ||||
| 		Fail(t, fmt.Sprintf("Expected response body for \"%s\" to NOT contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body)) | ||||
| 		Fail(t, fmt.Sprintf("Expected response body for \"%s\" to NOT contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body), msgAndArgs...) | ||||
| 	} | ||||
| 
 | ||||
| 	return !contains | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue