Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

patronus

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

patronus - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

yarn.lock

7

lib/internalUse.js

@@ -7,3 +7,3 @@ /*jslint node: true */

var Joi = require('joi'),
combinatorics = require('js-combinatorics').Combinatorics,
combinatorics = require('js-combinatorics'),
queryString = require('query-string'),

@@ -27,3 +27,2 @@ _ = require('lodash'),

userTests = settings.plugins.patronus.testValues;
}

@@ -57,4 +56,2 @@

// example combo: { payload: [ { name: 'username'...} ] }
// reset the test
var test = {

@@ -76,3 +73,3 @@ description: settings.description,

status: undefined,
schema: settings.response && Joi.compile(settings.response.schema)
schema: (settings.response && settings.response.schema) && Joi.compile(settings.response.schema)
}

@@ -79,0 +76,0 @@ };

@@ -97,3 +97,2 @@ /*jslint node: true */

exports.assert = function (raw, responseObj) {
if (responseObj.status && responseObj.status[raw.statusCode]) {

@@ -100,0 +99,0 @@ return joiAssert(raw.result, responseObj.status[raw.statusCode], 'Response check');

{
"name": "patronus",
"version": "1.1.3",
"version": "1.1.4",
"description": "Specification-driven REST API testing",

@@ -28,15 +28,15 @@ "main": "lib/Patronus.js",

"dependencies": {
"joi": "^6.0.0",
"joi": "^10.0.5",
"joi-assert": "0.0.3",
"js-combinatorics": "^0.4.0",
"lodash": "^3.6.0",
"query-string": "^1.0.0"
"js-combinatorics": "^0.5.2",
"lodash": "^4.17.2",
"query-string": "^4.2.3"
},
"devDependencies": {
"hapi": "^8.4.0",
"hapi-auth-bearer-token": "^3.1.1",
"istanbul": "^0.3.8",
"mocha": "^2.2.0",
"mocha-lcov-reporter": "^0.0.2"
"hapi": "^16.0.1",
"hapi-auth-bearer-token": "^4.3.1",
"istanbul": "^0.4.5",
"mocha": "^3.2.0",
"mocha-lcov-reporter": "^1.2.0"
}
}

@@ -14,9 +14,10 @@ (function() {

var genaricTestRun = function(server, tests) {
tests.user.forEach(function (test) {
it(test.description, function(done) {
server.inject(test.request, function(res) {
Patronus.assert(res, test.response);
done();
});
server.inject(test.request)
.then(res => {
Patronus.assert(res, test.response);
})
.then(done)
.catch(done);
});

@@ -27,3 +28,2 @@ });

var testShouldFail = function(server, tests) {
tests.user.forEach(function (test) {

@@ -52,4 +52,7 @@ it(test.description, function(done) {

server.connection({ port: 9999, labels: 'api' });
server.connection({ port: 9998, labels: 'web' });
var apiServer = server.select('api');
describe('test basic route gathering', function() {

@@ -75,5 +78,3 @@ var route = '/basic';

genaricTestRun(apiServer, Patronus.testsFromRoute(method, route, server));
genaricTestRun(apiServer, Patronus.testsFromRoute(method, route, apiServer));
});

@@ -152,4 +153,2 @@

genaricTestRun(apiServer, Patronus.testsFromRoute(method, route, server));

@@ -191,4 +190,2 @@

genaricTestRun(apiServer, Patronus.testsFromRoute(method, route, server));

@@ -258,4 +255,2 @@

genaricTestRun(apiServer, Patronus.testsFromRoute(method, route, server));

@@ -378,18 +373,3 @@

var tests = Patronus.testsFromRoute(method, route, server);
tests.user.forEach(function (test) {
it(test.description, function(done) {
apiServer.inject(test.request, function(res) {
try {
Patronus.assert(res, test.response);
} catch(e) {
assert.ifError(e);
} finally {
done();
}
});
});
});
genaricTestRun(apiServer, Patronus.testsFromRoute(method, route, server));
});

@@ -446,3 +426,2 @@

describe('should run tests from just select routes', function() {
server.connection({ port: 9998, labels: 'web' });
var webServer = server.select('web');

@@ -487,32 +466,65 @@

});
});
apiServer.route({
method: method,
path: route,
config: {
description: 'Test for an auth token of 1234',
auth: 'simple',
response: {
schema: Joi.object({
success: Joi.boolean()
})
apiServer.route({
method: method,
path: route,
config: {
description: 'Test for an auth token of 1234',
auth: 'simple',
response: {
schema: Joi.object({
success: Joi.boolean()
})
},
plugins:{
patronus: {
testValues: [{
username: 'user-name',
password: 'user-name',
__auth: {
headers: {
authorization: 'Bearer 1234'
}
}
}]
}
}
},
plugins:{
patronus: {
testValues: [{
username: 'user-name',
password: 'user-name',
__auth: {
headers: {
authorization: 'Bearer 1234'
handler: function(request, reply) {
reply({success: true});
}
});
apiServer.route({
method: 'POST',
path: '/auth/optional',
config: {
description: 'Test for an auth token of 1234',
auth: {
strategies: ['simple'],
mode: 'optional'
},
response: {
schema: Joi.object({
success: Joi.boolean()
})
},
plugins:{
patronus: {
testValues: [{
username: 'user-name',
password: 'user-name',
__auth: {
headers: {
authorization: 'Bearer 1234'
}
}
}
}]
}]
}
}
},
handler: function(request, reply) {
reply({success: true});
}
},
handler: function(request, reply) {
reply({success: true});
}
});
});

@@ -528,37 +540,3 @@

apiServer.route({
method: method,
path: route,
config: {
description: 'Test for an auth token of 1234',
auth: {
strategies: ['simple'],
mode: 'optional'
},
response: {
schema: Joi.object({
success: Joi.boolean()
})
},
plugins:{
patronus: {
testValues: [{
username: 'user-name',
password: 'user-name',
__auth: {
headers: {
authorization: 'Bearer 1234'
}
}
}]
}
}
},
handler: function(request, reply) {
reply({success: true});
}
});
genaricTestRun(apiServer, Patronus.testsFromRoute(method, route, server));
});

@@ -603,6 +581,4 @@

genaricTestRun(apiServer, Patronus.testsFromRoute(method, route, server));
});
});
})();

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc