@@ -43,22 +43,31 @@ func Test0BoxNFTCollection(testSetup *testing.T) {
4343 t := test .NewSystemTest (testSetup )
4444
4545 t .RunSequentially ("List nft collections with zero nft collections should work" , func (t * test.SystemTest ) {
46- headers := zboxClient .NewZboxHeaders ( client .X_APP_BLIMP )
46+ headers := zboxClient .NewZboxHeadersWithCSRF ( t , client .X_APP_BLIMP )
4747 Teardown (t , headers )
4848
49+ // Refresh CSRF token after teardown to ensure it's valid
50+ headers = zboxClient .NewZboxHeadersWithCSRF (t , client .X_APP_BLIMP )
51+
4952 nftCollectionList , response , err := zboxClient .GetNftCollections (t , headers )
5053 require .NoError (t , err )
5154 require .Equal (t , 200 , response .StatusCode (), "Response status code does not match expected. Output: [%v]" , response .String ())
5255 require .Equal (t , int64 (0 ), nftCollectionList .NftCollectionCount )
5356 })
5457
5558 t .RunSequentially ("List nft collections with nft collections should work" , func (t * test.SystemTest ) {
56- headers := zboxClient .NewZboxHeaders ( client .X_APP_BLIMP )
59+ headers := zboxClient .NewZboxHeadersWithCSRF ( t , client .X_APP_BLIMP )
5760 Teardown (t , headers )
5861
62+ // Refresh CSRF token after teardown to ensure it's valid
63+ headers = zboxClient .NewZboxHeadersWithCSRF (t , client .X_APP_BLIMP )
64+
5965 err := Create0boxTestAllocation (t , headers )
6066 require .NoError (t , err )
6167
68+ // Refresh CSRF token after wallet creation to ensure it's valid
69+ headers = zboxClient .NewZboxHeadersWithCSRF (t , client .X_APP_BLIMP )
70+
6271 nftCollectionData := NewTestNFTCollection ()
6372 _ , response , err := zboxClient .CreateNftCollection (t , headers , nftCollectionData )
6473 require .NoError (t , err )
@@ -71,12 +80,18 @@ func Test0BoxNFTCollection(testSetup *testing.T) {
7180 })
7281
7382 t .RunSequentially ("update nft collection with collection present should work" , func (t * test.SystemTest ) {
74- headers := zboxClient .NewZboxHeaders ( client .X_APP_BLIMP )
83+ headers := zboxClient .NewZboxHeadersWithCSRF ( t , client .X_APP_BLIMP )
7584 Teardown (t , headers )
7685
86+ // Refresh CSRF token after teardown to ensure it's valid
87+ headers = zboxClient .NewZboxHeadersWithCSRF (t , client .X_APP_BLIMP )
88+
7789 err := Create0boxTestAllocation (t , headers )
7890 require .NoError (t , err )
7991
92+ // Refresh CSRF token after wallet creation to ensure it's valid
93+ headers = zboxClient .NewZboxHeadersWithCSRF (t , client .X_APP_BLIMP )
94+
8095 nftCollectionData := NewTestNFTCollection ()
8196 _ , response , err := zboxClient .CreateNftCollection (t , headers , nftCollectionData )
8297 require .NoError (t , err )
@@ -93,12 +108,18 @@ func Test0BoxNFTCollection(testSetup *testing.T) {
93108 })
94109
95110 t .RunSequentially ("update nft collection with no collection present should not work" , func (t * test.SystemTest ) {
96- headers := zboxClient .NewZboxHeaders ( client .X_APP_BLIMP )
111+ headers := zboxClient .NewZboxHeadersWithCSRF ( t , client .X_APP_BLIMP )
97112 Teardown (t , headers )
98113
114+ // Refresh CSRF token after teardown to ensure it's valid
115+ headers = zboxClient .NewZboxHeadersWithCSRF (t , client .X_APP_BLIMP )
116+
99117 err := Create0boxTestAllocation (t , headers )
100118 require .NoError (t , err )
101119
120+ // Refresh CSRF token after wallet creation to ensure it's valid
121+ headers = zboxClient .NewZboxHeadersWithCSRF (t , client .X_APP_BLIMP )
122+
102123 nftCollectionData := NewTestNFTCollection ()
103124 nftCollectionData ["collection_name" ] = "new_collection_name"
104125 updateResponse , response , err := zboxClient .UpdateNftCollection (t , headers , nftCollectionData )
@@ -112,22 +133,31 @@ func Test0BoxNFT(testSetup *testing.T) {
112133 t := test .NewSystemTest (testSetup )
113134
114135 t .RunSequentially ("List nfts with zero nfts should work" , func (t * test.SystemTest ) {
115- headers := zboxClient .NewZboxHeaders ( client .X_APP_BLIMP )
136+ headers := zboxClient .NewZboxHeadersWithCSRF ( t , client .X_APP_BLIMP )
116137 Teardown (t , headers )
117138
139+ // Refresh CSRF token after teardown to ensure it's valid
140+ headers = zboxClient .NewZboxHeadersWithCSRF (t , client .X_APP_BLIMP )
141+
118142 nftList , response , err := zboxClient .GetAllNfts (t , headers )
119143 require .NoError (t , err )
120144 require .Equal (t , 200 , response .StatusCode (), "Response status code does not match expected. Output: [%v]" , response .String ())
121145 require .Equal (t , int64 (0 ), nftList .NftCount )
122146 })
123147
124148 t .RunSequentially ("List nfts with nfts should work" , func (t * test.SystemTest ) {
125- headers := zboxClient .NewZboxHeaders ( client .X_APP_BLIMP )
149+ headers := zboxClient .NewZboxHeadersWithCSRF ( t , client .X_APP_BLIMP )
126150 Teardown (t , headers )
127151
152+ // Refresh CSRF token after teardown to ensure it's valid
153+ headers = zboxClient .NewZboxHeadersWithCSRF (t , client .X_APP_BLIMP )
154+
128155 err := Create0boxTestAllocation (t , headers )
129156 require .NoError (t , err )
130157
158+ // Refresh CSRF token after wallet creation to ensure it's valid
159+ headers = zboxClient .NewZboxHeadersWithCSRF (t , client .X_APP_BLIMP )
160+
131161 nftCollectionData := NewTestNFTCollection ()
132162 _ , response , err := zboxClient .CreateNftCollection (t , headers , nftCollectionData )
133163 require .NoError (t , err )
@@ -145,12 +175,18 @@ func Test0BoxNFT(testSetup *testing.T) {
145175 })
146176
147177 t .RunSequentially ("update nft with nft present should work" , func (t * test.SystemTest ) {
148- headers := zboxClient .NewZboxHeaders ( client .X_APP_BLIMP )
178+ headers := zboxClient .NewZboxHeadersWithCSRF ( t , client .X_APP_BLIMP )
149179 Teardown (t , headers )
150180
181+ // Refresh CSRF token after teardown to ensure it's valid
182+ headers = zboxClient .NewZboxHeadersWithCSRF (t , client .X_APP_BLIMP )
183+
151184 err := Create0boxTestAllocation (t , headers )
152185 require .NoError (t , err )
153186
187+ // Refresh CSRF token after wallet creation to ensure it's valid
188+ headers = zboxClient .NewZboxHeadersWithCSRF (t , client .X_APP_BLIMP )
189+
154190 nftCollectionData := NewTestNFTCollection ()
155191 _ , response , err := zboxClient .CreateNftCollection (t , headers , nftCollectionData )
156192 require .NoError (t , err )
@@ -174,11 +210,17 @@ func Test0BoxNFT(testSetup *testing.T) {
174210 })
175211
176212 t .RunSequentially ("update nft with no nft present should not work" , func (t * test.SystemTest ) {
177- headers := zboxClient .NewZboxHeaders ( client .X_APP_BLIMP )
213+ headers := zboxClient .NewZboxHeadersWithCSRF ( t , client .X_APP_BLIMP )
178214 Teardown (t , headers )
179215
216+ // Refresh CSRF token after teardown to ensure it's valid
217+ headers = zboxClient .NewZboxHeadersWithCSRF (t , client .X_APP_BLIMP )
218+
180219 err := Create0boxTestAllocation (t , headers )
181220 require .NoError (t , err )
221+
222+ // Refresh CSRF token after wallet creation to ensure it's valid
223+ headers = zboxClient .NewZboxHeadersWithCSRF (t , client .X_APP_BLIMP )
182224 nftData := NewTestNFT ()
183225 nftData ["stage" ] = "mint_nft"
184226 _ , response , err := zboxClient .UpdateNft (t , headers , nftData , 1 )
0 commit comments