@@ -3360,12 +3360,62 @@ func TestGetContractListenerStatus(t *testing.T) {
33603360 httpmock .ActivateNonDefault (e .client .GetClient ())
33613361 defer httpmock .DeactivateAndReset ()
33623362
3363- _ , detail , status , err := e .GetContractListenerStatus (context .Background (), "ns1" , "id" , true )
3363+ e .streams = & streamManager {
3364+ client : e .client ,
3365+ }
3366+
3367+ httpmock .RegisterResponder ("GET" , "http://localhost:12345/subscriptions/id" ,
3368+ httpmock .NewJsonResponderOrPanic (200 , subscription {
3369+ ID : "sb-cb37cc07-e873-4f58-44ab-55add6bba320" , Stream : "es12345" , Name : "ff-sub-ns1-11232312312" ,
3370+ }))
3371+
3372+ found , detail , status , err := e .GetContractListenerStatus (context .Background (), "ns1" , "id" , true )
3373+ assert .True (t , found )
3374+ assert .Nil (t , detail )
3375+ assert .Equal (t , core .ContractListenerStatusUnknown , status )
3376+ assert .NoError (t , err )
3377+ }
3378+
3379+ func TestGetContractListenerStatusNotFound (t * testing.T ) {
3380+ e , cancel := newTestFabric ()
3381+ defer cancel ()
3382+ httpmock .ActivateNonDefault (e .client .GetClient ())
3383+ defer httpmock .DeactivateAndReset ()
3384+
3385+ e .streams = & streamManager {
3386+ client : e .client ,
3387+ }
3388+
3389+ httpmock .RegisterResponder ("GET" , "http://localhost:12345/subscriptions/id" ,
3390+ httpmock .NewJsonResponderOrPanic (404 , nil ))
3391+
3392+ found , detail , status , err := e .GetContractListenerStatus (context .Background (), "ns1" , "id" , true )
3393+ assert .False (t , found )
33643394 assert .Nil (t , detail )
33653395 assert .Equal (t , core .ContractListenerStatusUnknown , status )
33663396 assert .NoError (t , err )
33673397}
33683398
3399+ func TestGetContractListenerStatusError (t * testing.T ) {
3400+ e , cancel := newTestFabric ()
3401+ defer cancel ()
3402+ httpmock .ActivateNonDefault (e .client .GetClient ())
3403+ defer httpmock .DeactivateAndReset ()
3404+
3405+ e .streams = & streamManager {
3406+ client : e .client ,
3407+ }
3408+
3409+ httpmock .RegisterResponder ("GET" , "http://localhost:12345/subscriptions/id" ,
3410+ httpmock .NewJsonResponderOrPanic (500 , nil ))
3411+
3412+ found , detail , status , err := e .GetContractListenerStatus (context .Background (), "ns1" , "id" , true )
3413+ assert .False (t , found )
3414+ assert .Nil (t , detail )
3415+ assert .Equal (t , core .ContractListenerStatusUnknown , status )
3416+ assert .Error (t , err )
3417+ }
3418+
33693419func TestGetTransactionStatus (t * testing.T ) {
33703420 e , cancel := newTestFabric ()
33713421 defer cancel ()
0 commit comments