@@ -372,132 +372,6 @@ test('clear everything', function (t) {
372372 } ) ;
373373} ) ;
374374
375- test ( '/check `recoveryPhoneSendCode` by email' , function ( t ) {
376- const action = 'recoveryPhoneSendCode' ;
377- return (
378- client
379- . postAsync ( '/check' , {
380- ip : TEST_IP ,
381- 382- action,
383- } )
384- . spread ( function ( req , res , obj ) {
385- t . equal ( res . statusCode , 200 , 'returns a 200' ) ;
386- t . equal ( obj . block , false , 'not rate limited' ) ;
387- return client . postAsync ( '/check' , {
388- ip : TEST_IP ,
389- 390- action,
391- } ) ;
392- } )
393- . spread ( function ( req , res , obj ) {
394- t . equal ( res . statusCode , 200 , 'returns a 200' ) ;
395- t . equal ( obj . block , false , 'not rate limited' ) ;
396- return client . postAsync ( '/check' , {
397- ip : TEST_IP ,
398- 399- action,
400- } ) ;
401- } )
402- . spread ( function ( req , res , obj ) {
403- t . equal ( res . statusCode , 200 , 'returns a 200' ) ;
404- t . equal ( obj . block , true , 'rate limited' ) ;
405- t . equal ( obj . retryAfter , 1 , 'rate limit retry amount' ) ;
406-
407- // Delay ~1s for rate limit to go away
408- return Promise . delay ( 1010 ) ;
409- } )
410-
411- // Reissue requests to verify that throttling is disabled
412- . then ( function ( ) {
413- return client . postAsync ( '/check' , {
414- ip : TEST_IP ,
415- 416- action,
417- } ) ;
418- } )
419- . spread ( function ( req , res , obj ) {
420- t . equal ( res . statusCode , 200 , 'returns a 200' ) ;
421- t . equal ( obj . block , false , 'not rate limited' ) ;
422- t . end ( ) ;
423- } )
424- . catch ( function ( err ) {
425- t . fail ( err ) ;
426- t . end ( ) ;
427- } )
428- ) ;
429- } ) ;
430-
431- test ( 'clear everything' , function ( t ) {
432- mcHelper . clearEverything ( function ( err ) {
433- t . notOk ( err , 'no errors were returned' ) ;
434- t . end ( ) ;
435- } ) ;
436- } ) ;
437-
438- test ( '/check `recoveryPhoneCreate` by email' , function ( t ) {
439- const action = 'recoveryPhoneCreate' ;
440- return (
441- client
442- . postAsync ( '/check' , {
443- ip : TEST_IP ,
444- 445- action,
446- } )
447- . spread ( function ( req , res , obj ) {
448- t . equal ( res . statusCode , 200 , 'returns a 200' ) ;
449- t . equal ( obj . block , false , 'not rate limited' ) ;
450- return client . postAsync ( '/check' , {
451- ip : TEST_IP ,
452- 453- action,
454- } ) ;
455- } )
456- . spread ( function ( req , res , obj ) {
457- t . equal ( res . statusCode , 200 , 'returns a 200' ) ;
458- t . equal ( obj . block , false , 'not rate limited' ) ;
459- return client . postAsync ( '/check' , {
460- ip : TEST_IP ,
461- 462- action,
463- } ) ;
464- } )
465- . spread ( function ( req , res , obj ) {
466- t . equal ( res . statusCode , 200 , 'returns a 200' ) ;
467- t . equal ( obj . block , true , 'rate limited' ) ;
468- t . equal ( obj . retryAfter , 1 , 'rate limit retry amount' ) ;
469-
470- // Delay ~1s for rate limit to go away
471- return Promise . delay ( 1010 ) ;
472- } )
473-
474- // Reissue requests to verify that throttling is disabled
475- . then ( function ( ) {
476- return client . postAsync ( '/check' , {
477- ip : TEST_IP ,
478- 479- action,
480- } ) ;
481- } )
482- . spread ( function ( req , res , obj ) {
483- t . equal ( res . statusCode , 200 , 'returns a 200' ) ;
484- t . equal ( obj . block , false , 'not rate limited' ) ;
485- t . end ( ) ;
486- } )
487- . catch ( function ( err ) {
488- t . fail ( err ) ;
489- t . end ( ) ;
490- } )
491- ) ;
492- } ) ;
493-
494- test ( 'clear everything' , function ( t ) {
495- mcHelper . clearEverything ( function ( err ) {
496- t . notOk ( err , 'no errors were returned' ) ;
497- t . end ( ) ;
498- } ) ;
499- } ) ;
500-
501375test ( 'teardown' , async function ( t ) {
502376 await testServer . stop ( ) ;
503377 t . end ( ) ;
0 commit comments