@@ -193,4 +193,52 @@ describe("SipPeer", function(){
193193 peer . moveTns ( data , done ) ;
194194 } ) ;
195195 } ) ;
196+ describe ( "#listApplication" , function ( ) {
197+ it ( "should list application" , function ( done ) {
198+ var span = helper . nock ( ) . get ( "/accounts/FakeAccountId/sites/1/sippeers/10/products/messaging/applicationSettings" ) . reply ( 200 , helper . xml . peerApplications , { "Content-Type" : "application/xml" } ) ;
199+ var peer = new SipPeer ( ) ;
200+ peer . id = 10 ;
201+ peer . siteId = 1 ;
202+ peer . client = helper . createClient ( ) ;
203+ peer . listApplication ( function ( err , results ) {
204+ if ( err ) {
205+ done ( err ) ;
206+ } else {
207+ results . httpMessagingV2AppId [ 0 ] . should . equal ( 100 )
208+ done ( ) ;
209+ }
210+ } ) ;
211+ } ) ;
212+ } ) ;
213+ describe ( "#editApplication" , function ( ) {
214+ it ( "should edit the application" , function ( done ) {
215+ var appData = { httpMessagingV2AppId : 100 }
216+ var span = helper . nock ( ) . put ( "/accounts/FakeAccountId/sites/1/sippeers/10/products/messaging/applicationSettings" , helper . buildXml ( { applicationsSettings : appData } ) ) . reply ( 200 , helper . xml . peerApplications , { "Content-Type" : "application/xml" } ) ;
217+ var peer = new SipPeer ( ) ;
218+ peer . id = 10 ;
219+ peer . siteId = 1 ;
220+ peer . client = helper . createClient ( ) ;
221+ var appData = { httpMessagingV2AppId : 100 }
222+ peer . editApplication ( appData , function ( err , results ) {
223+ if ( err ) {
224+ done ( err ) ;
225+ } else {
226+ results . httpMessagingV2AppId . should . equal ( 100 )
227+ done ( ) ;
228+ }
229+ } ) ;
230+ } ) ;
231+ } ) ;
232+ describe ( "#removeApplication" , function ( ) {
233+ it ( "should remove application" , function ( done ) {
234+ var appData = 'REMOVE' ;
235+ var span = helper . nock ( ) . put ( "/accounts/FakeAccountId/sites/1/sippeers/10/products/messaging/applicationSettings" , helper . buildXml ( { applicationsSettings : appData } ) ) . reply ( 200 , helper . xml . peerApplications , { "Content-Type" : "application/xml" } ) ;
236+ var peer = new SipPeer ( ) ;
237+ peer . id = 10 ;
238+ peer . siteId = 1 ;
239+ peer . client = helper . createClient ( ) ;
240+ peer . removeApplication ( done ) ;
241+ } ) ;
242+ } ) ;
243+
196244} ) ;
0 commit comments