r100343 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100342‎ | r100343 | r100344 >
Date:13:44, 20 October 2011
Author:hashar
Status:reverted
Tags:
Comment:
test against an anonymous user!

One can visit [[Special:JavaScriptTest/qunit]] as a logged in user thus
tests for anonymous user failed.
Modified paths:
  • /branches/JSTesting/tests/qunit/suites/resources/mediawiki/mediawiki.user.test.js (modified) (history)

Diff [purge]

Index: branches/JSTesting/tests/qunit/suites/resources/mediawiki/mediawiki.user.test.js
@@ -16,6 +16,19 @@
1717 test( 'User login status', function() {
1818 expect(5);
1919
 20+ /**
 21+ * Tests can be run under three different conditions:
 22+ * 1) From tests/qunit/index.html, user will be anonymous.
 23+ * 2) Logged in on [[Special:JavaScriptTest/qunit]]
 24+ * 3) Anonymously at the same special page.
 25+ */
 26+
 27+ // remember current user to restore it later on.
 28+ var savedUsername = mw.config.get( 'wgUserName' );
 29+
 30+ // Forge an anonymous user:
 31+ mw.config.set( 'wgUserName', null);
 32+
2033 strictEqual( mw.user.name(), null, 'user.name should return null when anonymous' );
2134 ok( mw.user.anonymous(), 'user.anonymous should reutrn true when anonymous' );
2235
@@ -26,4 +39,7 @@
2740 ok( !mw.user.anonymous(), 'user.anonymous returns false when logged-in' );
2841
2942 equal( mw.user.id(), 'John', 'user.id Returns username when logged-in' );
 43+
 44+ // restore previous user
 45+ mw.config.set( 'wgUserName', savedUsername );
3046 });

Follow-up revisions

RevisionCommit summaryAuthorDate
r101341Run test with an anonymous user...hashar09:02, 31 October 2011

Status & tagging log