@@ -131,6 +131,9 @@ type testServerOptions struct {
131131 NodeStatus * status.Service
132132 PinIntegrity api.PinIntegrity
133133 WhitelistedAddr string
134+ FullAPIDisabled bool
135+ ChequebookDisabled bool
136+ SwapDisabled bool
134137}
135138
136139func newTestServer (t * testing.T , o testServerOptions ) (* http.Client , * websocket.Conn , string , * chanStorer ) {
@@ -179,7 +182,7 @@ func newTestServer(t *testing.T, o testServerOptions) (*http.Client, *websocket.
179182 erc20 := erc20mock .New (o .Erc20Opts ... )
180183 backend := backendmock .New (o .BackendOpts ... )
181184
182- var extraOpts = api.ExtraOptions {
185+ extraOpts : = api.ExtraOptions {
183186 TopologyDriver : topologyDriver ,
184187 Accounting : acc ,
185188 Pseudosettle : recipient ,
@@ -207,7 +210,7 @@ func newTestServer(t *testing.T, o testServerOptions) (*http.Client, *websocket.
207210 o .BeeMode = api .FullMode
208211 }
209212
210- s := api .New (o .PublicKey , o .PSSPublicKey , o .EthereumAddress , []string {o .WhitelistedAddr }, o .Logger , transaction , o .BatchStore , o .BeeMode , true , true , backend , o .CORSAllowedOrigins , inmemstore .New ())
213+ s := api .New (o .PublicKey , o .PSSPublicKey , o .EthereumAddress , []string {o .WhitelistedAddr }, o .Logger , transaction , o .BatchStore , o .BeeMode , ! o . ChequebookDisabled , ! o . SwapDisabled , backend , o .CORSAllowedOrigins , inmemstore .New ())
211214 testutil .CleanupCloser (t , s )
212215
213216 s .SetP2P (o .P2P )
@@ -231,9 +234,10 @@ func newTestServer(t *testing.T, o testServerOptions) (*http.Client, *websocket.
231234 WsPingPeriod : o .WsPingPeriod ,
232235 }, extraOpts , 1 , erc20 )
233236
234- s .MountTechnicalDebug ()
235- s .MountDebug ()
236- s .MountAPI ()
237+ s .Mount ()
238+ if ! o .FullAPIDisabled {
239+ s .EnableFullAPI ()
240+ }
237241
238242 if o .DirectUpload {
239243 chanStore = newChanStore (o .Storer .PusherFeed ())
@@ -316,7 +320,7 @@ func TestParseName(t *testing.T) {
316320 const bzzHash = "89c17d0d8018a19057314aa035e61c9d23c47581a61dd3a79a7839692c617e4d"
317321 log := log .Noop
318322
319- var errInvalidNameOrAddress = errors .New ("invalid name or bzz address" )
323+ errInvalidNameOrAddress : = errors .New ("invalid name or bzz address" )
320324
321325 testCases := []struct {
322326 desc string
@@ -377,7 +381,8 @@ func TestParseName(t *testing.T) {
377381
378382 s := api .New (pk .PublicKey , pk .PublicKey , common.Address {}, nil , log , nil , nil , 1 , false , false , nil , []string {"*" }, inmemstore .New ())
379383 s .Configure (signer , nil , api.Options {}, api.ExtraOptions {Resolver : tC .res }, 1 , nil )
380- s .MountAPI ()
384+ s .Mount ()
385+ s .EnableFullAPI ()
381386
382387 tC := tC
383388 t .Run (tC .desc , func (t * testing.T ) {
@@ -503,9 +508,7 @@ func TestPostageHeaderError(t *testing.T) {
503508func TestOptions (t * testing.T ) {
504509 t .Parallel ()
505510
506- var (
507- client , _ , _ , _ = newTestServer (t , testServerOptions {})
508- )
511+ client , _ , _ , _ := newTestServer (t , testServerOptions {})
509512 for _ , tc := range []struct {
510513 endpoint string
511514 expectedMethods string // expectedMethods contains HTTP methods like GET, POST, HEAD, PATCH, DELETE, OPTIONS. These are in alphabetical sorted order
0 commit comments