Content deleted Content added
Update template tests |
SilverLocust (talk | contribs) fix one |
||
(45 intermediate revisions by 9 users not shown) | |||
Line 1:
-- Unit tests for [[Module:Protection banner/config]]. Click talk page to run tests.
local pp = require('Module:Protection banner')
Line 22:
function suite:assertProtectionCategoryEquals(expected, action, level, namespace, reason, expiry)
local
local fakeTitleObj = mw.title.new(fakePageName, namespace)
local protectionObj = suite.makeFakeProtectionObj(
{
Line 31 ⟶ 32:
expiry = expiry
},
cfgModule,
fakeTitleObj
)
local actual = protectionObj:makeProtectionCategory()
expected = string.format('[[Category:%s|%s]]', expected, fakePageName)
self:assertEquals(expected, actual)
end
Line 47 ⟶ 49:
d.pc = 'autoreview'
d.semi = 'autoconfirmed'
d.extended = 'extendedconfirmed'
d.template = 'templateeditor'
d.full = 'sysop'
d.dispute = 'dispute'
d.pc1 = 'autoconfirmed'
d.vand = 'vandalism'
d.blp = 'blp'
Line 139 ⟶ 141:
--------------------------------------------------------------------------------
function suite:
self:assertProtectionCategoryEquals('Wikipedia pages move-protected due to dispute', d.move, d.full, 0, d.dispute, nil)
end
Line 184 ⟶ 186:
function suite:testCategory_edit_semi_file_vandalism_all()
self:assertProtectionCategoryEquals('
end
function suite:testCategory_edit_semi_wikipedia_vandalism_all()
self:assertProtectionCategoryEquals('
end
function suite:testCategory_edit_semi_help_vandalism_all()
self:assertProtectionCategoryEquals('
end
function suite:testCategory_edit_semi_portal_vandalism_all()
self:assertProtectionCategoryEquals('
end
Line 204 ⟶ 206:
function suite:testCategory_edit_semi_talk_vandalism_all()
self:assertProtectionCategoryEquals('
end
Line 220 ⟶ 222:
function suite:testCategory_edit_semi_file_vandalism_temp()
self:assertProtectionCategoryEquals('
end
function suite:testCategory_edit_semi_wikipedia_vandalism_temp()
self:assertProtectionCategoryEquals('
end
function suite:testCategory_edit_semi_help_vandalism_temp()
self:assertProtectionCategoryEquals('
end
function suite:testCategory_edit_semi_portal_vandalism_temp()
self:assertProtectionCategoryEquals('
end
Line 240 ⟶ 242:
function suite:testCategory_edit_semi_talk_vandalism_temp()
self:assertProtectionCategoryEquals('
end
Line 252 ⟶ 254:
function suite:testCategory_edit_full_user_vandalism_all()
self:assertProtectionCategoryEquals('Wikipedia fully protected user and user talk pages', d.edit, d.full, 2, d.vand, nil)
end
function suite:testCategory_edit_full_usertalk_vandalism_all()
self:assertProtectionCategoryEquals('Wikipedia fully protected user and user talk pages', d.edit, d.full, 3, d.vand, nil)
end
function suite:testCategory_edit_full_file_vandalism_all()
self:assertProtectionCategoryEquals('
end
function suite:testCategory_edit_full_wikipedia_vandalism_all()
self:assertProtectionCategoryEquals('
end
function suite:testCategory_edit_full_help_vandalism_all()
self:assertProtectionCategoryEquals('
end
Line 276 ⟶ 278:
function suite:testCategory_edit_full_template_vandalism_all()
self:assertProtectionCategoryEquals('Wikipedia fully
end
function suite:testCategory_edit_full_talk_vandalism_all()
self:assertProtectionCategoryEquals('
end
Line 288 ⟶ 290:
function suite:testCategory_edit_full_user_vandalism_temp()
self:assertProtectionCategoryEquals('Wikipedia fully protected user and user talk pages', d.edit, d.full, 2, d.vand, d.temp)
end
function suite:testCategory_edit_full_usertalk_vandalism_temp()
self:assertProtectionCategoryEquals('Wikipedia fully protected user and user talk pages', d.edit, d.full, 3, d.vand, d.temp)
end
function suite:testCategory_edit_full_file_vandalism_temp()
self:assertProtectionCategoryEquals('
end
function suite:testCategory_edit_full_wikipedia_vandalism_temp()
self:assertProtectionCategoryEquals('
end
function suite:testCategory_edit_full_help_vandalism_temp()
self:assertProtectionCategoryEquals('
end
Line 312 ⟶ 314:
function suite:testCategory_edit_full_template_vandalism_temp()
self:assertProtectionCategoryEquals('Wikipedia fully
end
function suite:testCategory_edit_full_talk_vandalism_temp()
self:assertProtectionCategoryEquals('
end
Line 412 ⟶ 414:
function suite:testCategory_edit_full_template_all_all()
self:assertProtectionCategoryEquals('Wikipedia fully
end
function suite:testCategory_edit_full_template_all_temp()
self:assertProtectionCategoryEquals('Wikipedia fully
end
Line 425 ⟶ 427:
function suite:testCategory_edit_template_template_all_temp()
self:assertProtectionCategoryEquals('Wikipedia template-protected templates', d.edit, d.template, 10, nil, d.temp)
end
function suite:testCategory_edit_extended_template_all_all()
self:assertProtectionCategoryEquals('Wikipedia extended-confirmed-protected templates', d.edit, d.extended, 10, nil, nil)
end
function suite:testCategory_move_template_template_all_all()
self:assertProtectionCategoryEquals('Wikipedia template-protected templates', d.move, d.template, 10, nil, nil)
end
Line 433 ⟶ 443:
function suite:testCategory_edit_full_template_all_temp()
self:assertProtectionCategoryEquals('Wikipedia move-protected templates', d.move, d.full, 10, nil, d.temp)
end
function suite:testCategory_edit_template_templatetalk_all_all()
self:assertProtectionCategoryEquals('Wikipedia template-protected pages other than templates and modules', d.edit, d.template, 11, nil, nil)
end
--------------------------------------------------------------------------------
-- Categories: module
--------------------------------------------------------------------------------
function suite:testCategory_edit_semi_module_all_all()
self:assertProtectionCategoryEquals('Wikipedia semi-protected modules', d.edit, d.semi, 828, d.indef, nil)
end
function suite:testCategory_edit_semi_module_all_temp()
self:assertProtectionCategoryEquals('Wikipedia semi-protected modules', d.edit, d.semi, 828, nil, d.temp)
end
function suite:testCategory_edit_full_module_all_all()
self:assertProtectionCategoryEquals('Wikipedia fully protected modules', d.edit, d.full, 828, nil, nil)
end
function suite:testCategory_edit_full_module_all_temp()
self:assertProtectionCategoryEquals('Wikipedia fully protected modules', d.edit, d.full, 828, nil, d.temp)
end
function suite:testCategory_edit_template_module_all_all()
self:assertProtectionCategoryEquals('Wikipedia template-protected modules', d.edit, d.template, 828, nil, nil)
end
function suite:testCategory_edit_template_module_all_temp()
self:assertProtectionCategoryEquals('Wikipedia template-protected modules', d.edit, d.template, 828, nil, d.temp)
end
Line 448 ⟶ 490:
function suite:testCategory_edit_full_user_all_all()
self:assertProtectionCategoryEquals('Wikipedia fully protected user and user talk pages', d.edit, d.full, 2, nil, nil)
end
function suite:testCategory_edit_full_usertalk_all_all()
self:assertProtectionCategoryEquals('Wikipedia fully protected user and user talk pages', d.edit, d.full, 3, nil, nil)
end
Line 464 ⟶ 506:
function suite:testCategory_edit_full_user_all_temp()
self:assertProtectionCategoryEquals('Wikipedia fully protected user and user talk pages', d.edit, d.full, 2, nil, d.temp)
end
function suite:testCategory_edit_full_usertalk_all_temp()
self:assertProtectionCategoryEquals('Wikipedia fully protected user and user talk pages', d.edit, d.full, 3, nil, d.temp)
end
Line 652 ⟶ 694:
function suite:testCategory_edit_semi_file_all_indef()
self:assertProtectionCategoryEquals('
end
function suite:testCategory_edit_semi_wikipedia_all_indef()
self:assertProtectionCategoryEquals('
end
function suite:testCategory_edit_semi_help_all_indef()
self:assertProtectionCategoryEquals('
end
function suite:testCategory_edit_semi_portal_all_indef()
self:assertProtectionCategoryEquals('
end
Line 672 ⟶ 714:
function suite:testCategory_edit_semi_talk_all_indef()
self:assertProtectionCategoryEquals('
end
function suite:testCategory_edit_semi_main_all_indef()
self:assertProtectionCategoryEquals('Wikipedia indefinitely semi-protected pages', d.edit, d.semi, 0, nil, d.indef)
end
function suite:testCategory_edit_semi_main_all_all()
self:assertProtectionCategoryEquals('Wikipedia indefinitely semi-protected pages', d.edit, d.semi, 0, nil, nil)
end
Line 717 ⟶ 763:
function suite:testCategory_move_full_main_all_indef()
self:assertProtectionCategoryEquals('Wikipedia indefinitely move-protected pages', d.move, d.full, 0, nil, d.indef)
end
function suite:testCategory_move_full_main_all_all()
self:assertProtectionCategoryEquals('Wikipedia indefinitely move-protected pages', d.move, d.full, 0, nil, nil)
end
Line 732 ⟶ 782:
function suite:testCategory_edit_semi_file_all_all()
self:assertProtectionCategoryEquals('
end
function suite:testCategory_edit_semi_wikipedia_all_all()
self:assertProtectionCategoryEquals('
end
function suite:testCategory_edit_semi_help_all_all()
self:assertProtectionCategoryEquals('
end
function suite:testCategory_edit_semi_portal_all_all()
self:assertProtectionCategoryEquals('
end
Line 756 ⟶ 806:
function suite:testCategory_edit_semi_talk_all_all()
self:assertProtectionCategoryEquals('
end
function suite:
self:assertProtectionCategoryEquals('Wikipedia semi-protected pages', d.edit, d.semi, 0, nil,
end
function suite:testCategory_edit_extended_main_all_all()
self:assertProtectionCategoryEquals('Wikipedia extended-confirmed-protected pages', d.edit, d.extended, 0, nil, nil)
end
function suite:testCategory_edit_full_user_all_all()
self:assertProtectionCategoryEquals('Wikipedia fully protected user and user talk pages', d.edit, d.full, 2, nil, nil)
end
function suite:testCategory_edit_full_usertalk_all_all()
self:assertProtectionCategoryEquals('Wikipedia fully protected user and user talk pages', d.edit, d.full, 3, nil, nil)
end
function suite:testCategory_edit_full_file_all_all()
self:assertProtectionCategoryEquals('
end
function suite:testCategory_edit_full_wikipedia_all_all()
self:assertProtectionCategoryEquals('
end
function suite:testCategory_edit_full_help_all_all()
self:assertProtectionCategoryEquals('
end
function suite:testCategory_edit_full_portal_all_all()
self:assertProtectionCategoryEquals('Wikipedia fully protected pages', d.edit, d.full, 100, nil, nil)
end
function suite:testCategory_edit_full_template_all_all()
self:assertProtectionCategoryEquals('Wikipedia fully
end
function suite:testCategory_edit_full_category_all_all()
self:assertProtectionCategoryEquals('Wikipedia fully protected categories', d.edit, d.full, 14, nil, nil)
end
function suite:testCategory_edit_full_talk_all_all()
self:assertProtectionCategoryEquals('
end
function suite:testCategory_edit_full_main_all_all()
self:assertProtectionCategoryEquals('Wikipedia fully protected pages', d.edit, d.full, 0, nil, nil)
end
Line 843 ⟶ 897:
end
function suite:
self:assertProtectionCategoryEquals('Wikipedia move-protected pages', d.move, d.full, 0, nil,
end
function suite:testCategory_move_extended_main_all_all()
self:assertProtectionCategoryEquals('Wikipedia extended-confirmed-protected pages', d.move, d.extended, 0, nil, nil)
end
function suite:testCategory_move_extended_template_all_all()
self:assertProtectionCategoryEquals('Wikipedia extended-confirmed-protected templates', d.move, d.extended, 10, nil, nil)
end
Line 884 ⟶ 946:
function suite:testCategory_pc_pc1_user_all_all()
self:assertProtectionCategoryEquals('Wikipedia pending changes protected pages
end
function suite:testCategory_pc_pc1_usertalk_all_all()
self:assertProtectionCategoryEquals('Wikipedia pending changes protected pages
end
function suite:testCategory_pc_pc1_file_all_all()
self:assertProtectionCategoryEquals('Wikipedia pending changes protected pages
end
function suite:testCategory_pc_pc1_wikipedia_all_all()
self:assertProtectionCategoryEquals('Wikipedia pending changes protected pages
end
function suite:testCategory_pc_pc1_help_all_all()
self:assertProtectionCategoryEquals('Wikipedia pending changes protected pages
end
function suite:testCategory_pc_pc1_portal_all_all()
self:assertProtectionCategoryEquals('Wikipedia pending changes protected pages
end
function suite:testCategory_pc_pc1_template_all_all()
self:assertProtectionCategoryEquals('Wikipedia pending changes protected pages
end
function suite:testCategory_pc_pc1_category_all_all()
self:assertProtectionCategoryEquals('Wikipedia pending changes protected pages
end
function suite:testCategory_pc_pc1_talk_all_all()
self:assertProtectionCategoryEquals('Wikipedia pending changes protected pages
end
function suite:testCategory_pc_pc1_main_all_all()
self:assertProtectionCategoryEquals('Wikipedia pending changes protected pages
end
|