@@ -119,6 +119,50 @@ describe('Installations', () => {
119
119
} ) . catch ( ( error ) => { console . log ( error ) ; } ) ;
120
120
} ) ;
121
121
122
+ it ( 'should properly fail queying installations' , ( done ) => {
123
+ var installId = '12345678-abcd-abcd-abcd-123456789abc' ;
124
+ var device = 'android' ;
125
+ var input = {
126
+ 'installationId' : installId ,
127
+ 'deviceType' : device
128
+ } ;
129
+ rest . create ( config , auth . nobody ( config ) , '_Installation' , input )
130
+ . then ( ( ) => {
131
+ let query = new Parse . Query ( Parse . Installation ) ;
132
+ return query . find ( )
133
+ } ) . then ( ( results ) => {
134
+ fail ( 'Should not succeed!' ) ;
135
+ done ( ) ;
136
+ } ) . catch ( ( error ) => {
137
+ expect ( error . code ) . toBe ( 119 ) ;
138
+ expect ( error . message ) . toBe ( 'Clients aren\'t allowed to perform the find operation on the installation collection.' )
139
+ done ( ) ;
140
+ } ) ;
141
+ } ) ;
142
+
143
+ it ( 'should properly queying installations with masterKey' , ( done ) => {
144
+ var installId = '12345678-abcd-abcd-abcd-123456789abc' ;
145
+ var device = 'android' ;
146
+ var input = {
147
+ 'installationId' : installId ,
148
+ 'deviceType' : device
149
+ } ;
150
+ rest . create ( config , auth . nobody ( config ) , '_Installation' , input )
151
+ . then ( ( ) => {
152
+ let query = new Parse . Query ( Parse . Installation ) ;
153
+ return query . find ( { useMasterKey : true } ) ;
154
+ } ) . then ( ( results ) => {
155
+ expect ( results . length ) . toEqual ( 1 ) ;
156
+ var obj = results [ 0 ] . toJSON ( ) ;
157
+ expect ( obj . installationId ) . toEqual ( installId ) ;
158
+ expect ( obj . deviceType ) . toEqual ( device ) ;
159
+ done ( ) ;
160
+ } ) . catch ( ( error ) => {
161
+ fail ( 'Should not fail' ) ;
162
+ done ( ) ;
163
+ } ) ;
164
+ } ) ;
165
+
122
166
it ( 'fails with missing ids' , ( done ) => {
123
167
var input = {
124
168
'deviceType' : 'android' ,
0 commit comments