@@ -67,93 +67,6 @@ describe("export tests", function () {
6767
6868 const userId = mongoose . Types . ObjectId ( ) ;
6969
70- it ( "should export observations as kml - deprecated" , function ( done ) {
71-
72- mockTokenWithPermission ( 'READ_OBSERVATION_ALL' ) ;
73-
74- const eventId = 1 ;
75- const mockEvent = new EventModel ( {
76- _id : eventId ,
77- name : 'Mock Event' ,
78- collectionName : 'observations1'
79- } ) ;
80-
81- sinon . mock ( EventModel )
82- . expects ( 'findById' )
83- . twice ( )
84- . onFirstCall ( )
85- . yields ( null , mockEvent )
86- . onSecondCall ( )
87- . yields ( null , mockEvent ) ;
88-
89- sinon . mock ( UserModel )
90- . expects ( 'find' )
91- . chain ( 'exec' )
92- . yields ( null , [ {
93- username : 'user1'
94- } , {
95- username : 'user2'
96- } ] ) ;
97-
98- sinon . mock ( DeviceModel )
99- . expects ( 'find' )
100- . chain ( 'exec' )
101- . resolves ( [ {
102- uid : '1'
103- } , {
104- uid : '2'
105- } ] ) ;
106-
107- const ObservationModel = observationModel ( {
108- _id : 1 ,
109- name : 'Event 1' ,
110- collectionName : 'observations1' ,
111- style : { }
112- } ) ;
113- const mockObservation = new ObservationModel ( {
114- _id : mongoose . Types . ObjectId ( ) ,
115- type : 'Feature' ,
116- geometry : {
117- type : "Point" ,
118- coordinates : [ 0 , 0 ]
119- } ,
120- properties : {
121- timestamp : Date . now ( ) ,
122- forms : [ ]
123- }
124- } ) ;
125-
126- sinon . mock ( ObservationModel )
127- . expects ( 'find' )
128- . chain ( 'exec' )
129- . yields ( null , [ mockObservation ] ) ;
130-
131- sinon . mock ( IconModel )
132- . expects ( 'find' )
133- . yields ( null , [ {
134- relativePath : 'mock/path'
135- } ] ) ;
136-
137- const fs = {
138- '/var/lib/mage/icons/1' : { }
139- } ;
140- mockfs ( fs ) ;
141-
142- request ( app )
143- . get ( '/api/kml?eventId=1&observations=true&locations=false&attachments=false' )
144- . set ( 'Accept' , 'application/json' )
145- . set ( 'Authorization' , 'Bearer 12345' )
146- . expect ( 200 )
147- . expect ( function ( res ) {
148- res . headers . should . have . property ( 'content-type' ) . that . equals ( 'application/zip' ) ;
149- res . headers . should . have . property ( 'content-disposition' ) . that . equals ( 'attachment; filename="mage-kml.zip"' ) ;
150- } )
151- . end ( function ( err ) {
152- mockfs . restore ( ) ;
153- done ( err ) ;
154- } ) ;
155- } ) ;
156-
15770 it ( "should export observations as kml" , function ( done ) {
15871
15972 mockTokenWithPermission ( 'READ_OBSERVATION_ALL' ) ;
0 commit comments