@@ -8,11 +8,9 @@ package endpoint_test
88
99import (
1010 "context"
11- "regexp"
1211 "sync"
1312 "testing"
1413
15- "github.com/DATA-DOG/go-sqlmock"
1614 "github.com/hyperledger-labs/fabric-smart-client/platform/view/services/endpoint"
1715 "github.com/hyperledger-labs/fabric-smart-client/platform/view/services/endpoint/mock"
1816 "github.com/hyperledger-labs/fabric-smart-client/platform/view/view"
@@ -181,50 +179,3 @@ func TestGetIdentity(t *testing.T) {
181179 assert .ErrorIs (t , err , endpoint .ErrNotFound )
182180 assert .False (t , ok )
183181}
184-
185- func TestPutBindings_MultipleEphemerals3 (t * testing.T ) {
186- ctx := context .Background ()
187-
188- // // Create mock DB and mock expectations
189- _ , mock1 , err := sqlmock .New ()
190- // require.NoError(t, err)
191- // defer func() { _ = db.Close() }()
192-
193- // // Wrap sqlmock's db into RWDB
194- // rwdb := &common3.RWDB{
195- // WriteDB: db,
196- // ReadDB: db,
197- // }
198-
199- // // Prepare table names
200- // tables := common2.TableNames{
201- // Binding: "bindings",
202- // }
203-
204- store := & mock.BindingStore {}
205-
206- // Create store using constructor
207- // store, err := NewBindingStore(rwdb, tables)
208- // require.NoError(t, err)
209-
210- // Input identities
211- longTerm := view .Identity ("long" )
212- e1 := view .Identity ("eph1" )
213- e2 := view .Identity ("eph2" )
214-
215- // Expected SQL query
216-
217- expectedSQL := regexp .QuoteMeta (`SELECT long_term_id FROM bindings WHERE ephemeral_hash = $1` )
218- mock1 .ExpectQuery (expectedSQL ).
219- WithArgs (longTerm .UniqueID ()).
220- WillReturnRows (sqlmock .NewRows ([]string {"long_term_id" })) // empty rows = no results
221-
222- expectedSQL = regexp .QuoteMeta (`INSERT INTO bindings (ephemeral_hash, long_term_id) VALUES ($1, $2), ($3, $4), ($5, $6) ON CONFLICT DO NOTHING;` )
223- mock1 .ExpectExec (expectedSQL ).
224- WithArgs (longTerm .UniqueID (), longTerm , e1 .UniqueID (), longTerm , e2 .UniqueID (), longTerm ).
225- WillReturnResult (sqlmock .NewResult (1 , 2 ))
226-
227- err = store .PutBindings (ctx , longTerm , e1 , e2 )
228- require .NoError (t , err )
229- require .NoError (t , mock1 .ExpectationsWereMet ())
230- }
0 commit comments