@@ -857,7 +857,7 @@ describe( "Observations", ( ) => {
857857 // controller will load fresh data from the ES index, so if we want to see
858858 // a change without actually changing data, we need to stub the v1
859859 // controller reponse
860- sinon . stub ( ObservationsController , "update" )
860+ const stub = sinon . stub ( ObservationsController , "update" )
861861 . callsFake (
862862 ( ) => ( { ...fixtureObs , description : newDesc } )
863863 ) ;
@@ -869,10 +869,34 @@ describe( "Observations", ( ) => {
869869 . expect ( res => {
870870 expect ( res . body . results [ 0 ] . uuid ) . to . eq ( fixtureObs . uuid ) ;
871871 expect ( res . body . results [ 0 ] . description ) . to . eq ( newDesc ) ;
872+ stub . restore ( ) ;
872873 } )
873874 . expect ( "Content-Type" , / j s o n / )
874875 . expect ( 200 , done ) ;
875876 } ) ;
877+
878+ it ( "defaults ignore_photos to true" , function ( done ) {
879+ nock ( "http://localhost:3000" )
880+ . put ( `/observations/${ fixtureObs . uuid } ` , JSON . stringify ( { ignore_photos : true } ) )
881+ . reply ( 200 , [ { id : fixtureObs . id , uuid : fixtureObs . uuid } ] ) ;
882+ request ( this . app ) . put ( `/v2/observations/${ fixtureObs . uuid } ` )
883+ . set ( "Authorization" , token )
884+ . set ( "Content-Type" , "application/json" )
885+ . expect ( 200 , done ) ;
886+ } ) ;
887+
888+ it ( "can set ignore_photos to false" , function ( done ) {
889+ nock ( "http://localhost:3000" )
890+ . put ( `/observations/${ fixtureObs . uuid } ` , JSON . stringify ( { ignore_photos : false } ) )
891+ . reply ( 200 , [ { id : fixtureObs . id , uuid : fixtureObs . uuid } ] ) ;
892+ request ( this . app ) . put ( `/v2/observations/${ fixtureObs . uuid } ` )
893+ . send ( {
894+ ignore_photos : false
895+ } )
896+ . set ( "Authorization" , token )
897+ . set ( "Content-Type" , "application/json" )
898+ . expect ( 200 , done ) ;
899+ } ) ;
876900 } ) ;
877901
878902 describe ( "delete" , ( ) => {
0 commit comments