From f19a6a3356bb60aa4745d62890fb404f57248653 Mon Sep 17 00:00:00 2001 From: Acha Bill Date: Tue, 12 Nov 2024 15:26:09 -0500 Subject: [PATCH] fix: access control soc --- pkg/api/accesscontrol_test.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pkg/api/accesscontrol_test.go b/pkg/api/accesscontrol_test.go index 509a2cea1b8..c00318c1afb 100644 --- a/pkg/api/accesscontrol_test.go +++ b/pkg/api/accesscontrol_test.go @@ -100,6 +100,7 @@ func TestAccessLogicEachEndpointWithAct(t *testing.T) { resp struct { Reference swarm.Address `json:"reference"` } + direct bool }{ { name: "bzz", @@ -159,6 +160,7 @@ func TestAccessLogicEachEndpointWithAct(t *testing.T) { data: bytes.NewReader(sch.WrappedChunk.Data()), expdata: sch.Chunk().Data(), contenttype: "binary/octet-stream", + direct: true, }, } @@ -183,13 +185,24 @@ func TestAccessLogicEachEndpointWithAct(t *testing.T) { upTestOpts = append(upTestOpts, jsonhttptest.WithRequestHeader(api.SwarmCollectionHeader, "True")) } t.Run(v.name, func(t *testing.T) { - client, _, _, _ := newTestServer(t, testServerOptions{ + client, _, _, chanStore := newTestServer(t, testServerOptions{ Storer: storerMock, Logger: logger, Post: mockpost.New(mockpost.WithAcceptAll()), PublicKey: pk.PublicKey, AccessControl: mockac.New(), + DirectUpload: v.direct, }) + + if chanStore != nil { + chanStore.Subscribe(func(chunk swarm.Chunk) { + err := storerMock.Put(context.Background(), chunk) + if err != nil { + t.Fatal(err) + } + }) + } + header := jsonhttptest.Request(t, client, http.MethodPost, v.upurl, http.StatusCreated, upTestOpts..., )