@@ -840,92 +840,4 @@ describe('Kuzzle methods', function () {
840840 } ) ;
841841 } ) ;
842842
843- describe ( '#updateSelf' , function ( ) {
844- var expectedQuery = {
845- action : 'updateSelf' ,
846- controller : 'auth'
847- } ;
848-
849- beforeEach ( function ( ) {
850- sandbox . stub ( kuzzle , 'query' ) . callsFake ( queryStub ) ;
851- result = {
852- result : {
853- _id : 'foobar' ,
854- _source : {
855- name : {
856- first : 'John' ,
857- last : 'Doe'
858- }
859- }
860- }
861- } ;
862- } ) ;
863-
864- it ( 'should send the right query to Kuzzle even without callback' , function ( ) {
865- kuzzle . updateSelf ( { foo : 'bar' } ) ;
866- should ( kuzzle . query ) . be . calledOnce ( ) ;
867- should ( kuzzle . query ) . be . calledWith ( expectedQuery , { body : { foo : 'bar' } } ) ;
868- } ) ;
869-
870- it ( 'should send the right query to Kuzzle' , function ( ) {
871- var cb = sinon . stub ( ) ;
872-
873- kuzzle . updateSelf ( { foo : 'bar' } , cb ) ;
874- should ( kuzzle . query ) . be . calledOnce ( ) ;
875- should ( kuzzle . query ) . be . calledWith ( expectedQuery , { body : { foo : 'bar' } } ) ;
876- should ( cb ) . be . calledOnce ( ) ;
877- should ( cb ) . be . calledWithExactly ( null , result . result ) ;
878-
879- } ) ;
880-
881- it ( 'should execute the callback with an error if an error occurs' , function ( ) {
882- var cb = sinon . stub ( ) ;
883-
884- error = 'foobar' ;
885- kuzzle . updateSelf ( { foo : 'bar' } , cb ) ;
886- should ( cb ) . be . calledOnce ( ) ;
887- should ( cb ) . be . calledWithExactly ( 'foobar' , undefined ) ;
888- } ) ;
889- } ) ;
890-
891- describe ( '#validateMyCredentials' , function ( ) {
892- it ( 'should trigger callback with an error' , function ( done ) {
893- var
894- cberror = { message : 'i am an error' } ,
895- spy = sandbox . stub ( kuzzle , 'query' ) . yields ( cberror ) ,
896- args ;
897-
898- kuzzle . validateMyCredentials ( 'strategy' , { username : 'foo' } , function ( err ) {
899- should ( err ) . be . exactly ( cberror ) ;
900- args = spy . firstCall . args ;
901-
902- should ( spy ) . be . calledOnce ( ) ;
903-
904- should ( args [ 0 ] . controller ) . be . exactly ( 'auth' ) ;
905- should ( args [ 0 ] . action ) . be . exactly ( 'validateMyCredentials' ) ;
906- should ( args [ 2 ] ) . be . exactly ( null ) ;
907- done ( ) ;
908- } ) ;
909- } ) ;
910-
911- it ( 'should call query with right arguments' , function ( done ) {
912- var
913- doc = { username : 'foo' } ,
914- spy = sandbox . stub ( kuzzle , 'query' ) . yields ( null , { result : true } ) ,
915- args ;
916-
917- kuzzle . validateMyCredentials ( 'strategy' , doc , function ( err , res ) {
918- should ( res ) . be . exactly ( true ) ;
919- args = spy . firstCall . args ;
920-
921- should ( spy ) . be . calledOnce ( ) ;
922-
923- should ( args [ 0 ] . controller ) . be . exactly ( 'auth' ) ;
924- should ( args [ 0 ] . action ) . be . exactly ( 'validateMyCredentials' ) ;
925- should ( args [ 2 ] ) . be . exactly ( null ) ;
926- done ( ) ;
927- } ) ;
928- } ) ;
929- } ) ;
930-
931843} ) ;
0 commit comments