feat: add http roundtripper mock and deterministic integration tests for allanime

This commit is contained in:
2026-06-16 10:59:26 +02:00
committed by Milas Holsting
parent 0d1ae305b5
commit 06b50509e8
2 changed files with 820 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
package allanime
import (
"io"
"net/http"
"strings"
)
type roundTripFunc func(*http.Request) (*http.Response, error)
func (f roundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) {
return f(req)
}
func mockStringResponse(status int, body string) *http.Response {
hdr := make(http.Header)
hdr.Set("Content-Type", "application/json")
return &http.Response{
StatusCode: status,
Header: hdr,
Body: io.NopCloser(strings.NewReader(body)),
}
}