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

api-testing

Package Overview
Dependencies
Maintainers
24
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-testing - npm Package Compare versions

Comparing version 1.5.1 to 1.6.0

4

.eslintrc.json

@@ -11,6 +11,4 @@ {

"indent": [ "error", "tab", {
"SwitchCase": 1,
"MemberExpression": "off"
"SwitchCase": 1
} ],
"no-multi-spaces": "off",
"no-underscore-dangle": "off",

@@ -17,0 +15,0 @@ "no-unused-vars": [ "error", { "args": "none" } ],

@@ -0,1 +1,7 @@

## 1.6.0
* Make failures of actionError assertions more helpful
* Use root to create other users
* Log errors when creating an account
* Add a new function that returns a blocked user
## 1.5.0

@@ -2,0 +8,0 @@ * Run mocha tests in parallel

@@ -68,3 +68,3 @@ 'use strict';

async user(name, groups = [], tokens = ['csrf']) {
async user(name, groups = [], tokens = ['csrf'], blocked = false) {
if (singletons[name]) {

@@ -80,3 +80,3 @@ return singletons[name];

const account = await client.createAccount({ username: uname, password: passwd });
const account = await root.createAccount({ username: uname, password: passwd });
uname = account.username;

@@ -93,2 +93,11 @@

if (blocked) {
const blockResult = await root.action('block', {
user: uname,
reason: 'Set up blocked user',
token: await root.token()
}, 'POST');
assert.exists(blockResult.block);
}
await client.account(uname, passwd);

@@ -112,2 +121,6 @@

async blockedUser() {
return this.user('Blocked user', [], ['csrf'], true);
},
async mindy() {

@@ -114,0 +127,0 @@ return this.user('Mindy', ['sysop'], ['userrights', 'csrf']);

@@ -94,7 +94,7 @@ 'use strict';

req = this.req.post(endpoint)
.type('form')
.send({ ...defaultParams, ...params });
.type('form')
.send({ ...defaultParams, ...params });
} else {
req = this.req.get(endpoint)
.query({ ...defaultParams, ...params });
.query({ ...defaultParams, ...params });
}

@@ -140,4 +140,4 @@

const res = await this.req.post(endpoint)
.field({ action: 'upload', format: 'json', ...params })
.attach('file', file);
.field({ action: 'upload', format: 'json', ...params })
.attach('file', file);

@@ -231,5 +231,5 @@ return res;

assert.equal(response.status, 200);
assert.exists(response.body);
assert.exists(response.body.error);
assert.equal(response.status, 200, 'An error response is expected to have a 200 status code');
assert.exists(response.body, 'An error response is expected to include a body');
assert.exists(response.body.error, 'An error response\'s body is expected to include an error object');
return response.body.error;

@@ -433,3 +433,4 @@ }

} catch (e) {
// console.log( 'T199393: Deadlock while creating account on attempt ' + i );
// Might be caused by a deadlock, see T199393. Log the error anyway.
console.log('Got error while creating account on attempt ' + i + ': ' + e);
await utils.sleep(1000);

@@ -436,0 +437,0 @@ }

@@ -50,19 +50,19 @@ 'use strict';

req = this.req.get(endpoint)
.query(params)
.set(headers);
.query(params)
.set(headers);
break;
case 'POST':
req = this.req.post(endpoint)
.send(params)
.set(headers);
.send(params)
.set(headers);
break;
case 'PUT':
req = this.req.put(endpoint)
.send(params)
.set(headers);
.send(params)
.set(headers);
break;
case 'DELETE':
req = this.req.del(endpoint)
.query(params)
.set(headers);
.query(params)
.set(headers);
break;

@@ -69,0 +69,0 @@ default:

{
"name": "api-testing",
"version": "1.5.1",
"version": "1.6.0",
"description": "",
"homepage": "https://gerrit.wikimedia.org/g/mediawiki/tools/api-testing",
"main": "index.js",

@@ -6,0 +7,0 @@ "scripts": {

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