Remove request and request-promise from dev dependencies (#5077)
* removes from emailverificationtoken spec * updates winston * Updates ValidationAndPasswordsReset * Use local request in schemas * Removes request in rest.spec * Removes request from PushRouter0 * removes request from public API * removes request from index.spec * Removes request form parse.push spec * removes request from ParseInstallation spec * Removes from ParseHooks * removes request from ParseGlobalConfig.spec * Removes request from ParseAPI.spec.js * removes request from LogsRouter * removes in features * Filters undefined headers instead of crashing * Removes request from ParseUser spec * Removes usage of request in ParseFile.spec.js * Removes request from AuthAdapters.js * removes request-promise from ParseGeoPoint.spec * Removes request-promise from ParseQuery spec * remove request-promise from UserPII * removes request-promise from EnableExpressErrorHandler * Updates RevocableSessionUpgrade spec * Update RestQuery * Removes read preferenceOptionM * ensure we forward auth from URL * use request in CloudCode.spec.js * Removes request-promise from JobSchedule.spec * Removes rp from VerifyUserPassword.spec.js * Removes rp from PasswordPolicy spec * Removes rp from ParsePolygon spec * Removes rp from fullTextSearch spec * Removes rp from PArseQuery.Aggregate * Ensure we properly forward errors * Removes request and request-promise
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
/* global describe, it, expect, fail, Parse */
|
||||
const request = require('request');
|
||||
const request = require('../lib/request');
|
||||
const triggers = require('../lib/triggers');
|
||||
const HooksController = require('../lib/Controllers/HooksController').default;
|
||||
const express = require('express');
|
||||
@@ -177,24 +177,21 @@ describe('Hooks', () => {
|
||||
});
|
||||
|
||||
it('should fail to register hooks without Master Key', done => {
|
||||
request.post(
|
||||
Parse.serverURL + '/hooks/functions',
|
||||
{
|
||||
headers: {
|
||||
'X-Parse-Application-Id': Parse.applicationId,
|
||||
'X-Parse-REST-API-Key': Parse.restKey,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
url: 'http://hello.word',
|
||||
functionName: 'SomeFunction',
|
||||
}),
|
||||
request({
|
||||
method: 'POST',
|
||||
url: Parse.serverURL + '/hooks/functions',
|
||||
headers: {
|
||||
'X-Parse-Application-Id': Parse.applicationId,
|
||||
},
|
||||
(err, res, body) => {
|
||||
body = JSON.parse(body);
|
||||
expect(body.error).toBe('unauthorized');
|
||||
done();
|
||||
}
|
||||
);
|
||||
body: JSON.stringify({
|
||||
url: 'http://hello.word',
|
||||
functionName: 'SomeFunction',
|
||||
}),
|
||||
}).then(fail, response => {
|
||||
const body = response.data;
|
||||
expect(body.error).toBe('unauthorized');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should fail trying to create two times the same function', done => {
|
||||
@@ -367,22 +364,20 @@ describe('Hooks', () => {
|
||||
});
|
||||
|
||||
it('should fail trying to create a malformed function (REST)', done => {
|
||||
request.post(
|
||||
Parse.serverURL + '/hooks/functions',
|
||||
{
|
||||
headers: {
|
||||
'X-Parse-Application-Id': Parse.applicationId,
|
||||
'X-Parse-Master-Key': Parse.masterKey,
|
||||
},
|
||||
body: JSON.stringify({ functionName: 'SomeFunction' }),
|
||||
request({
|
||||
method: 'POST',
|
||||
url: Parse.serverURL + '/hooks/functions',
|
||||
headers: {
|
||||
'X-Parse-Application-Id': Parse.applicationId,
|
||||
'X-Parse-Master-Key': Parse.masterKey,
|
||||
},
|
||||
(err, res, body) => {
|
||||
body = JSON.parse(body);
|
||||
expect(body.error).toBe('invalid hook declaration');
|
||||
expect(body.code).toBe(143);
|
||||
done();
|
||||
}
|
||||
);
|
||||
body: JSON.stringify({ functionName: 'SomeFunction' }),
|
||||
}).then(fail, response => {
|
||||
const body = response.data;
|
||||
expect(body.error).toBe('invalid hook declaration');
|
||||
expect(body.code).toBe(143);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should create hooks and properly preload them', done => {
|
||||
|
||||
Reference in New Issue
Block a user