增加统一倍率调整按钮
This commit is contained in:
1 parent
be655b6569
commit
4195525dc7
23 files changed
+750
-16
No files matched your search
@@ -2,6 +2,7 @@ package billing
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
@@ -74,6 +75,30 @@ func TestServiceQuoteDisabledReturnsNilWithoutAccessingRules(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestServiceCatalogReadsReturnSeedErrors(t *testing.T) {
|
||||
seedErr := errors.New("catalog refresh failed")
|
||||
for name, read := range map[string]func(*Service) error{
|
||||
"admin overview": func(service *Service) error {
|
||||
_, err := service.AdminOverview(context.Background())
|
||||
return err
|
||||
},
|
||||
"price list": func(service *Service) error {
|
||||
_, err := service.ListPrices(context.Background())
|
||||
return err
|
||||
},
|
||||
} {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
store := "eStoreStub{seedErr: seedErr}
|
||||
if err := read(NewService(store, nil)); !errors.Is(err, seedErr) {
|
||||
t.Fatalf("error = %v, want %v", err, seedErr)
|
||||
}
|
||||
if store.listCalls != 0 {
|
||||
t.Fatal("returned a stale price list after catalog refresh failed")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestServiceQuoteFreezesConservativeSeedanceReserve(t *testing.T) {
|
||||
store := "eStoreStub{rules: []PriceRule{{
|
||||
ID: "seedance-720", Provider: "seedance", Capability: "video.generate",
|
||||
@@ -230,6 +255,7 @@ type quoteStoreStub struct {
|
||||
rules []PriceRule
|
||||
seeded []PriceRule
|
||||
seedCalls int
|
||||
seedErr error
|
||||
listCalls int
|
||||
failOnAccess bool
|
||||
}
|
||||
@@ -237,7 +263,7 @@ type quoteStoreStub struct {
|
||||
func (s *quoteStoreStub) SeedBillingPriceRules(_ context.Context, rules []PriceRule) error {
|
||||
s.seedCalls++
|
||||
s.seeded = rules
|
||||
return nil
|
||||
return s.seedErr
|
||||
}
|
||||
func (s *quoteStoreStub) ListBillingPriceRules(context.Context, bool) ([]PriceRule, error) {
|
||||
s.listCalls++
|
||||
|
||||
Reference in new issue
Block a user