@@ -26,7 +26,6 @@ import (
2626 "github.com/ethersphere/bee/v2/pkg/jsonhttp/jsonhttptest"
2727 "github.com/ethersphere/bee/v2/pkg/log"
2828 mockpost "github.com/ethersphere/bee/v2/pkg/postage/mock"
29- testingsoc "github.com/ethersphere/bee/v2/pkg/soc/testing"
3029 mockstorer "github.com/ethersphere/bee/v2/pkg/storer/mock"
3130 "github.com/ethersphere/bee/v2/pkg/swarm"
3231 "gitlab.com/nolash/go-mockbytes"
@@ -77,16 +76,10 @@ func TestAccessLogicEachEndpointWithAct(t *testing.T) {
7776 storerMock = mockstorer .New ()
7877 logger = log .Noop
7978 now = time .Now ().Unix ()
80- chunk = swarm .NewChunk (
81- swarm .MustParseHexAddress ("0025737be11979e91654dffd2be817ac1e52a2dadb08c97a7cef12f937e707bc" ),
82- []byte {72 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 8 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 149 , 179 , 31 , 244 , 146 , 247 , 129 , 123 , 132 , 248 , 215 , 77 , 44 , 47 , 91 , 248 , 229 , 215 , 89 , 156 , 210 , 243 , 3 , 110 , 204 , 74 , 101 , 119 , 53 , 53 , 145 , 188 , 193 , 153 , 130 , 197 , 83 , 152 , 36 , 140 , 150 , 209 , 191 , 214 , 193 , 4 , 144 , 121 , 32 , 45 , 205 , 220 , 59 , 227 , 28 , 43 , 161 , 51 , 108 , 14 , 106 , 180 , 135 , 2 },
83- )
84- g = mockbytes .New (0 , mockbytes .MockTypeStandard ).WithModulus (255 )
85- bytedata , _ = g .SequentialBytes (swarm .ChunkSize * 2 )
86- tag , _ = storerMock .NewSession ()
87- sch = testingsoc .GenerateMockSOCWithKey (t , []byte ("foo" ), pk )
88- dirdata = []byte ("Lorem ipsum dolor sit amet" )
89- socResource = func (owner , id , sig string ) string { return fmt .Sprintf ("/soc/%s/%s?sig=%s" , owner , id , sig ) }
79+ g = mockbytes .New (0 , mockbytes .MockTypeStandard ).WithModulus (255 )
80+ bytedata , _ = g .SequentialBytes (swarm .ChunkSize * 2 )
81+ tag , _ = storerMock .NewSession ()
82+ dirdata = []byte ("Lorem ipsum dolor sit amet" )
9083 )
9184
9285 tc := []struct {
@@ -100,7 +93,6 @@ func TestAccessLogicEachEndpointWithAct(t *testing.T) {
10093 resp struct {
10194 Reference swarm.Address `json:"reference"`
10295 }
103- direct bool
10496 }{
10597 {
10698 name : "bzz" ,
@@ -141,27 +133,6 @@ func TestAccessLogicEachEndpointWithAct(t *testing.T) {
141133 expdata : bytedata ,
142134 contenttype : "application/octet-stream" ,
143135 },
144- {
145- name : "chunks" ,
146- upurl : "/chunks" ,
147- downurl : "/chunks" ,
148- exphash : "ca8d2d29466e017cba46d383e7e0794d99a141185ec525086037f25fc2093155" ,
149- resp : api.ChunkAddressResponse {Reference : swarm .MustParseHexAddress ("ca8d2d29466e017cba46d383e7e0794d99a141185ec525086037f25fc2093155" )},
150- data : bytes .NewReader (chunk .Data ()),
151- expdata : chunk .Data (),
152- contenttype : "binary/octet-stream" ,
153- },
154- {
155- name : "soc" ,
156- upurl : socResource (hex .EncodeToString (sch .Owner ), hex .EncodeToString (sch .ID ), hex .EncodeToString (sch .Signature )),
157- downurl : "/chunks" ,
158- exphash : "b100d7ce487426b17b98ff779fad4f2dd471d04ab1c8949dd2a1a78fe4a1524e" ,
159- resp : api.ChunkAddressResponse {Reference : swarm .MustParseHexAddress ("b100d7ce487426b17b98ff779fad4f2dd471d04ab1c8949dd2a1a78fe4a1524e" )},
160- data : bytes .NewReader (sch .WrappedChunk .Data ()),
161- expdata : sch .Chunk ().Data (),
162- contenttype : "binary/octet-stream" ,
163- direct : true ,
164- },
165136 }
166137
167138 for _ , v := range tc {
@@ -175,35 +146,21 @@ func TestAccessLogicEachEndpointWithAct(t *testing.T) {
175146 jsonhttptest .WithExpectedJSONResponse (v .resp ),
176147 jsonhttptest .WithRequestHeader (api .ContentTypeHeader , v .contenttype ),
177148 }
178- if v .name == "soc" {
179- upTestOpts = append (upTestOpts , jsonhttptest .WithRequestHeader (api .SwarmPinHeader , "true" ))
180- } else {
181- upTestOpts = append (upTestOpts , jsonhttptest .WithNonEmptyResponseHeader (api .SwarmTagHeader ))
182- }
149+ upTestOpts = append (upTestOpts , jsonhttptest .WithNonEmptyResponseHeader (api .SwarmTagHeader ))
183150 expcontenttype := v .contenttype
184151 if v .name == "bzz-dir" {
185152 expcontenttype = "text/plain; charset=utf-8"
186153 upTestOpts = append (upTestOpts , jsonhttptest .WithRequestHeader (api .SwarmCollectionHeader , "True" ))
187154 }
188155 t .Run (v .name , func (t * testing.T ) {
189- client , _ , _ , chanStore := newTestServer (t , testServerOptions {
156+ client , _ , _ , _ := newTestServer (t , testServerOptions {
190157 Storer : storerMock ,
191158 Logger : logger ,
192159 Post : mockpost .New (mockpost .WithAcceptAll ()),
193160 PublicKey : pk .PublicKey ,
194161 AccessControl : mockac .New (),
195- DirectUpload : v .direct ,
196162 })
197163
198- if chanStore != nil {
199- chanStore .Subscribe (func (chunk swarm.Chunk ) {
200- err := storerMock .Put (context .Background (), chunk )
201- if err != nil {
202- t .Fatal (err )
203- }
204- })
205- }
206-
207164 header := jsonhttptest .Request (t , client , http .MethodPost , v .upurl , http .StatusCreated ,
208165 upTestOpts ... ,
209166 )
@@ -218,7 +175,7 @@ func TestAccessLogicEachEndpointWithAct(t *testing.T) {
218175 jsonhttptest .WithExpectedResponseHeader (api .ContentTypeHeader , expcontenttype ),
219176 )
220177
221- if v .name != "bzz-dir" && v . name != "soc" && v . name != "chunks" {
178+ if v .name != "bzz-dir" {
222179 t .Run ("head" , func (t * testing.T ) {
223180 jsonhttptest .Request (t , client , http .MethodHead , v .downurl + "/" + v .exphash , http .StatusOK ,
224181 jsonhttptest .WithRequestHeader (api .SwarmActTimestampHeader , strconv .FormatInt (now , 10 )),
0 commit comments