Debian Codegraph @

tests/api-testing/action/Autopatrolling.js

raw symbols SCIP
1 'use strict';
2
3 const { assert, action, utils } = require( 'api-testing' );
4
5 describe( 'Testing default autopatrolling rights', () => {
6 const anonymousUser = action.getAnon();
7 let title, mindy;
8
9 before( async () => {
10 title = await utils.title( 'Autopatrol_' );
11 mindy = await action.mindy();
12 } );
13
14 it( 'should edit page as a user in autopatrol group', async () => {
15 await mindy.edit( title, { text: 'Is this page autopatrolled?' } );
16 } );
17
18 it( 'should edit page as an anonymous user', async () => {
19 await anonymousUser.edit( title, { text: 'Anonymous: Is this page autopatrolled?' } );
20 } );
21
22 it( 'should confirm autopatrolling rights', async () => {
23 const anonUserInfo = await anonymousUser.meta( 'userinfo', {} );
24 const result = await mindy.list( 'recentchanges', { rctitle: title, rcprop: 'patrolled|user' } );
25
26 assert.lengthOf( result, 2 );
27
28 // Test different properties if Temporary Accounts is enabled or not
29 const siteInfoQuery = await anonymousUser.action(
30 'query',
31 // fetch flag $wgAutoCreateTempUser['enabled'], and format to
32 // true/false for convenience
33 { meta: 'siteinfo', siprop: 'autocreatetempuser', formatversion: 2 }
34 );
35 if ( siteInfoQuery.query.autocreatetempuser.enabled ) {
36 assert.sameDeepMembers( result, [
37 { temp: '', type: 'edit', unpatrolled: '', user: anonUserInfo.name },
38 { type: 'new', patrolled: '', autopatrolled: '', user: mindy.username }
39 ] );
40 } else {
41 assert.sameDeepMembers( result, [
42 { anon: '', type: 'edit', unpatrolled: '', user: anonUserInfo.name },
43 { type: 'new', patrolled: '', autopatrolled: '', user: mindy.username }
44 ] );
45 }
46 } );
47 } );