mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-08 10:25:28 +08:00
22 lines
650 B
Go
22 lines
650 B
Go
package deepseek
|
|
|
|
import "testing"
|
|
|
|
func TestShouldAttemptRefreshOnTokenInvalidSignal(t *testing.T) {
|
|
if !shouldAttemptRefresh(401, 0, 0, "unauthorized", "") {
|
|
t.Fatal("expected refresh when response indicates invalid token")
|
|
}
|
|
}
|
|
|
|
func TestShouldAttemptRefreshOnBizCodeOnlyFailure(t *testing.T) {
|
|
if !shouldAttemptRefresh(200, 0, 400123, "", "session create failed") {
|
|
t.Fatal("expected refresh on non-zero biz_code with HTTP 200/code=0")
|
|
}
|
|
}
|
|
|
|
func TestShouldAttemptRefreshFalseOnGenericServerError(t *testing.T) {
|
|
if shouldAttemptRefresh(500, 500, 0, "internal error", "") {
|
|
t.Fatal("did not expect refresh on generic server error")
|
|
}
|
|
}
|