jenkins-bot has submitted this change and it was merged.

Change subject: Deprecate "prefix" parameter of setMwApi/removeMwApi.
......................................................................


Deprecate "prefix" parameter of setMwApi/removeMwApi.

We add some backward compatibility aliases, but you are expected to
pass a configuration object instead, and the "prefix" field is
now optional.

Change-Id: Ie07743e6a02c5fb66f4e83ccc944c4a56ec36bc0
---
M api/localsettings.js.example
M api/server.js
M lib/mediawiki.ParsoidConfig.js
M lib/mediawiki.Util.js
M lib/mediawiki.parser.environment.js
M tests/mocha/api.js
M tests/mocha/apitest.localsettings.js
M tests/parserTests.js
M tests/rttest.localsettings.js
9 files changed, 158 insertions(+), 72 deletions(-)

Approvals:
  Arlolra: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/api/localsettings.js.example b/api/localsettings.js.example
index 18bfc51..cadc791 100644
--- a/api/localsettings.js.example
+++ b/api/localsettings.js.example
@@ -18,11 +18,12 @@
        //parsoidConfig.userAgent = "My-User-Agent-String";
 
        // The URL of your MediaWiki API endpoint.
-       parsoidConfig.setMwApi('localhost', { uri: 'http://localhost/w/api.php' 
});
+       parsoidConfig.setMwApi({ prefix: 'localhost', uri: 
'http://localhost/w/api.php' });
        // To specify a proxy (or proxy headers) specific to this prefix (which
        // overrides defaultAPIProxyURI) use:
        /*
-       parsoidConfig.setMwApi('localhost', {
+       parsoidConfig.setMwApi({
+               prefix: 'localhost',
                uri: 'http://localhost/w/api.php',
                // set `proxy` to `null` to override and force no proxying.
                proxy: {
diff --git a/api/server.js b/api/server.js
index 8b9f8bd..ee54879 100755
--- a/api/server.js
+++ b/api/server.js
@@ -8,12 +8,13 @@
  * To configure locally, add localsettings.js to this directory and export a
  * setup function.
  *
- * example:
- *   exports.setup = function(parsoidConfig) {
- *     parsoidConfig.setMwApi('localhost', { uri: 'http://localhost/wiki' });
- *   };
+ * Example:
  *
- * (See localsettings.js.example for more options to setMwApi.)
+ *     exports.setup = function(parsoidConfig) {
+ *       parsoidConfig.setMwApi({ prefix: 'localhost', uri: 
'http://localhost/wiki' });
+ *     };
+ *
+ * (See `localsettings.js.example` for more options to setMwApi.)
  * Alternatively, specify a --config file explicitly. See --help for other
  * options.
  *
diff --git a/lib/mediawiki.ParsoidConfig.js b/lib/mediawiki.ParsoidConfig.js
index 88a80c0..f80ca8c 100644
--- a/lib/mediawiki.ParsoidConfig.js
+++ b/lib/mediawiki.ParsoidConfig.js
@@ -97,6 +97,7 @@
        this.mwApiRegexp = "";
        this.timeouts = Util.clone(CONFIG_DEFAULTS.timeouts);
        this.retries = Util.clone(CONFIG_DEFAULTS.retries);
+       this._uniq = 0;
 
        if (localSettings && localSettings.setup) {
                localSettings.setup(this);
@@ -364,6 +365,7 @@
                if (!this.mwApiMap.has(site.dbname)) {
                        var url = site.url;
                        var apiConf = {
+                               prefix: site.dbname,
                                uri: url + "/w/api.php",
                                proxy: {
                                        uri: proxyURI,
@@ -372,7 +374,7 @@
                                        strip_https: true,
                                },
                        };
-                       this.setMwApi(site.dbname, apiConf);
+                       this.setMwApi(apiConf);
                }
        };
 
@@ -401,17 +403,25 @@
 /**
  * @method
  *
- * Set an mw api configuration.
+ * Set up a wiki configuration.
  *
- * @param {String} prefix
- *   An arbitrary unique identifier for this wiki.
- * @param {String|Object} apiConf
- *   If a string, apiConf is the wiki's Action API URL.
+ * For backward compatibility, if there are two arguments the first is
+ * taken as a prefix and the second as the configuration, and if
+ * the configuration is a string it is used as the `uri` property
+ * in a new empty configuration object.  This usage is deprecated;
+ * we recommend users pass a configuration object as documented below.
+ *
+ * @param {Object} apiConf
+ *   The wiki configuration object.
  * @param {String} apiConf.uri
  *   The URL to the wiki's Action API (`api.php`).
+ *   This is the only mandatory argument.
  * @param {String} [apiConf.domain]
  *   The "domain" used to identify this wiki when using the Parsoid v2 API.
  *   It defaults to the hostname portion of `apiConf.uri`.
+ * @param {String} [apiConf.prefix]
+ *   An arbitrary unique identifier for this wiki.  If none is provided
+ *   a unique string will be generated.
  * @param {Object} [apiConf.proxy]
  *   A proxy configuration object.
  * @param {String|null} [apiConf.proxy.uri]
@@ -421,14 +431,36 @@
  * @param {Object} [apiConf.proxy.headers]
  *   Headers to add when proxying.
  */
-ParsoidConfig.prototype.setInterwiki =  // Alias for backwards compat.
-ParsoidConfig.prototype.setMwApi = function(prefix, apiConf) {
-       if (typeof apiConf === 'string') {
-               apiConf = { uri: apiConf };
+ParsoidConfig.prototype.setMwApi = function(apiConf) {
+       var prefix;
+       // Backward-compatibility with old calling conventions.
+       if (typeof arguments[0] === 'string') {
+               console.warn(
+                       'String arguments to ParsoidConfig#setMwApi are 
deprecated:',
+                       arguments[0]
+               );
+               if (typeof arguments[1] === 'string') {
+                       apiConf = { prefix: arguments[0], uri: arguments[1] };
+               } else if (typeof arguments[1] === 'object') {
+                       // Note that `apiConf` is aliased to `arguments[0]`.
+                       prefix = arguments[0];
+                       apiConf = arguments[1]; // overwrites `arguments[0]`
+                       apiConf.prefix = prefix;
+               } else {
+                       apiConf = { uri: arguments[0] };
+               }
+       }
+       console.assert(apiConf.uri, "Action API uri is mandatory.");
+       if (!apiConf.prefix) {
+               // Pick a unique prefix.
+               do {
+                       apiConf.prefix = 'wiki$' + (this._uniq++);
+               } while (this.mwApiMap.has(apiConf.prefix));
        }
        if (!apiConf.domain) {
                apiConf.domain = url.parse(apiConf.uri).host;
        }
+       prefix = apiConf.prefix;
 
        if (this.mwApiMap.has(prefix)) {
                this.reverseMwApiMap.delete(this.mwApiMap.get(prefix).domain);
@@ -443,17 +475,43 @@
 
 /**
  * @method
- *
- * Remove an mw api prefix.
- *
- * @param {string} prefix
+ * @inheritdoc #setMwApi
+ * @deprecated Use {@link #setMwApi} instead.
  */
-ParsoidConfig.prototype.removeInterwiki =  // Alias for backwards compat.
-ParsoidConfig.prototype.removeMwApi = function(prefix) {
-       if (!this.mwApiMap.has(prefix)) {
+ParsoidConfig.prototype.setInterwiki = ParsoidConfig.prototype.setMwApi;
+
+/**
+ * @method
+ *
+ * Remove an wiki configuration.
+ *
+ * @param {Object} apiConf
+ *   A wiki configuration object.  The value of `apiConf.domain`, or if
+ *   that is missing `apiConf.prefix`, will be used to locate the
+ *   configuration to remove.  Deprecated: if a string is passed, it
+ *   is used as the prefix to remove.
+ */
+ParsoidConfig.prototype.removeMwApi = function(apiConf) {
+       var prefix, domain;
+       if (typeof apiConf === 'string') {
+               console.warn(
+                       "Passing a string to ParsoidConfig#removeMwApi is 
deprecated:",
+                       apiConf
+               );
+               apiConf = { prefix: apiConf };
+       }
+       prefix = apiConf.prefix;
+       domain = apiConf.domain;
+       console.assert(prefix || domain, "Must pass either prefix or domain");
+       if (domain) {
+               prefix = this.reverseMwApiMap.get(domain);
+       }
+       if (!prefix || !this.mwApiMap.has(prefix)) {
                return;
        }
-       var domain = this.mwApiMap.get(prefix).domain;
+       if (!domain) {
+               domain = this.mwApiMap.get(prefix).domain;
+       }
        this.reverseMwApiMap.delete(domain);
        this.mwApiMap.delete(prefix);
        this.mwApiRegexp = this.mwApiRegexp.replace(
@@ -463,6 +521,13 @@
        );
 };
 
+/**
+ * @method
+ * @inheritdoc #removeMwApi
+ * @deprecated Use {@link #removeMwApi} instead.
+ */
+ParsoidConfig.prototype.removeInterwiki = ParsoidConfig.prototype.removeMwApi;
+
 // Useful internal function for testing
 ParsoidConfig.prototype._sanitizeIt = function() {
        this.sanitizeConfig(this, CONFIG_DEFAULTS);
diff --git a/lib/mediawiki.Util.js b/lib/mediawiki.Util.js
index 8c7fcc5..07ea4f7 100644
--- a/lib/mediawiki.Util.js
+++ b/lib/mediawiki.Util.js
@@ -212,7 +212,7 @@
                        parsoidConfig.storeDataParsoid = 
Util.booleanOption(opts.dp);
                }
                if (opts.apiURL) {
-                       parsoidConfig.setMwApi('customwiki', opts.apiURL);
+                       parsoidConfig.setMwApi({ prefix: 'customwiki', uri: 
opts.apiURL });
                }
                if (opts.addHTMLTemplateParameters !== undefined) {
                        parsoidConfig.addHTMLTemplateParameters =
diff --git a/lib/mediawiki.parser.environment.js 
b/lib/mediawiki.parser.environment.js
index e94d678..870b33c 100644
--- a/lib/mediawiki.parser.environment.js
+++ b/lib/mediawiki.parser.environment.js
@@ -243,6 +243,9 @@
        // Get that wiki's config
        return Promise.method(function() {
                options = options || {};
+               if (!options.prefix && options.domain && 
parsoidConfig.reverseMwApiMap.has(options.domain)) {
+                       options.prefix = 
parsoidConfig.reverseMwApiMap.get(options.domain);
+               }
                if (!options.prefix || 
!parsoidConfig.mwApiMap.has(options.prefix)) {
                        throw new Error('No API URI available for prefix: ' + 
options.prefix);
                }
diff --git a/tests/mocha/api.js b/tests/mocha/api.js
index d486b7c..ce10b6f 100644
--- a/tests/mocha/api.js
+++ b/tests/mocha/api.js
@@ -11,10 +11,10 @@
 
 describe('Parsoid API', function() {
        var api;
-       var mockHost;
+       var mockPrefix = 'mock.prefix';
+       var mockDomain = 'mock.domain';
        before(function() {
                var p = apiServer.startMockAPIServer({}).then(function(ret) {
-                       mockHost = url.parse(ret.url).host;
                        return apiServer.startParsoidServer({
                                mockUrl: ret.url,
                                serverArgv: [
@@ -31,7 +31,7 @@
 
        it("converts simple wikitext to HTML", function(done) {
                request(api)
-               .post('localhost/Main_Page')
+               .post(mockPrefix + '/Main_Page')
                .send({ wt: 'foo' })
                .expect(200)
                .expect(function(res) {
@@ -60,7 +60,7 @@
 
        it("converts simple HTML to wikitext", function(done) {
                request(api)
-               .post('localhost/Main_Page')
+               .post(mockPrefix + '/Main_Page')
                .send({ html: "<i>foo</i>" })
                .expect(200)
                .expect("''foo''", done);
@@ -68,7 +68,7 @@
 
        it("respects body parameter", function(done) {
                request(api)
-               .post('localhost/Main_Page')
+               .post(mockPrefix + '/Main_Page')
                .send({ wt: "''foo''", body: 1 })
                .expect(200)
                .expect(/^<body/, done);
@@ -76,7 +76,7 @@
 
        it("implements subst", function(done) {
                request(api)
-               .post('localhost/Main_Page')
+               .post(mockPrefix + '/Main_Page')
                .send({ wt: "{{echo|foo}}", subst: 'true' })
                .expect(200)
                .expect(function(res) {
@@ -100,17 +100,17 @@
 
                        it("should redirect title to latest revision", 
function(done) {
                                request(api)
-                               .get('v2/' + mockHost + '/html/Main_Page')
+                               .get('v2/' + mockDomain + '/html/Main_Page')
                                .expect(302)
                                .expect(function(res) {
-                                       res.header.location.should.equal('/v2/' 
+ mockHost + '/html/Main_Page/1');
+                                       res.header.location.should.equal('/v2/' 
+ mockDomain + '/html/Main_Page/1');
                                })
                                .end(done);
                        });
 
                        it("should preserve querystring params while 
redirecting", function(done) {
                                request(api)
-                               .get('v2/' + mockHost + 
'/html/Main_Page?test=123')
+                               .get('v2/' + mockDomain + 
'/html/Main_Page?test=123')
                                .expect(302)
                                .expect(function(res) {
                                        
res.headers.location.should.match(/\/html\/Main_Page\/1\?test=123$/);
@@ -120,7 +120,7 @@
 
                        it("should get html from a title and revision", 
function(done) {
                                request(api)
-                               .get('v2/' + mockHost + '/html/Main_Page/1')
+                               .get('v2/' + mockDomain + '/html/Main_Page/1')
                                .expect(200)
                                .expect(function(res) {
                                        var doc = 
domino.createDocument(res.text);
@@ -131,7 +131,7 @@
 
                        it('should return a pagebundle', function(done) {
                                request(api)
-                               .get('v2/' + mockHost + 
'/pagebundle/Main_Page/1')
+                               .get('v2/' + mockDomain + 
'/pagebundle/Main_Page/1')
                                .expect(200)
                                .expect(function(res) {
                                        res.body.should.have.property('html');
@@ -142,7 +142,7 @@
 
                        it('should accept the previous revision to reuse 
expansions', function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/html/Main_Page/1')
+                               .post('v2/' + mockDomain + '/html/Main_Page/1')
                                .send({
                                        previous: {
                                                revid: 0,
@@ -175,7 +175,7 @@
 
                        it('should accept the original and reuse certain 
expansions', function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/html/Main_Page/1')
+                               .post('v2/' + mockDomain + '/html/Main_Page/1')
                                .send({
                                        update: {
                                                templates: true,
@@ -211,7 +211,7 @@
 
                        it('should accept wikitext as a string for html', 
function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/html/')
+                               .post('v2/' + mockDomain + '/html/')
                                .send({
                                        wikitext: "== h2 ==",
                                })
@@ -225,7 +225,7 @@
 
                        it('should accept wikitext as a string for pagebundle', 
function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/pagebundle/')
+                               .post('v2/' + mockDomain + '/pagebundle/')
                                .send({
                                        wikitext: "== h2 ==",
                                })
@@ -241,7 +241,7 @@
 
                        it('should accept wikitext with headers', 
function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/html/')
+                               .post('v2/' + mockDomain + '/html/')
                                .send({
                                        wikitext: {
                                                headers: {
@@ -260,7 +260,7 @@
 
                        it('should require a title when no wikitext is 
provided', function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/html/')
+                               .post('v2/' + mockDomain + '/html/')
                                .send()
                                .expect(400)
                                .end(done);
@@ -268,7 +268,7 @@
 
                        it('should not require a title when wikitext is 
provided', function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/html/')
+                               .post('v2/' + mockDomain + '/html/')
                                .send({
                                        wikitext: "== h2 ==",
                                })
@@ -282,7 +282,7 @@
 
                        it('should accept the wikitext source as original 
data', function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/html/Main_Page/1')
+                               .post('v2/' + mockDomain + '/html/Main_Page/1')
                                .send({
                                        original: {
                                                wikitext: {
@@ -303,7 +303,7 @@
 
                        it("should respect body parameter", function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/html/')
+                               .post('v2/' + mockDomain + '/html/')
                                .send({
                                        wikitext: "''foo''",
                                        body: 1,
@@ -315,7 +315,7 @@
 
                        it('should include captured offsets', function(done) {
                                request(api)
-                               .get('v2/' + mockHost + 
'/pagebundle/Main_Page/1')
+                               .get('v2/' + mockDomain + 
'/pagebundle/Main_Page/1')
                                .expect(200)
                                .expect(function(res) {
                                        res.body.should.have.property('html');
@@ -327,7 +327,7 @@
 
                        it("should implement subst - simple", function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/html/')
+                               .post('v2/' + mockDomain + '/html/')
                                .send({wikitext: "{{echo|foo}}", subst: 'true'})
                                .expect(200)
                                .expect(function(res) {
@@ -347,7 +347,7 @@
 
                        it("should implement subst - internal tranclusion", 
function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/html/')
+                               .post('v2/' + mockDomain + '/html/')
                                .send({wikitext: "{{echo|foo {{echo|bar}} 
baz}}", subst: 'true'})
                                .expect(200)
                                .expect(function(res) {
@@ -372,7 +372,7 @@
 
                        it('should not allow subst with pagebundle', 
function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/pagebundle/')
+                               .post('v2/' + mockDomain + '/pagebundle/')
                                .send({wikitext: "{{echo|foo}}", subst: 'true'})
                                .expect(501)
                                .end(done);
@@ -384,7 +384,7 @@
 
                        it('should require html when serializing', 
function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/wt/')
+                               .post('v2/' + mockDomain + '/wt/')
                                .send()
                                .expect(400)
                                .end(done);
@@ -392,7 +392,7 @@
 
                        it('should accept html as a string', function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/wt/')
+                               .post('v2/' + mockDomain + '/wt/')
                                .send({
                                        html: '<!DOCTYPE html>\n<html 
prefix="dc: http://purl.org/dc/terms/ mw: http://mediawiki.org/rdf/"; 
about="http://localhost/index.php/Special:Redirect/revision/1";><head 
prefix="mwr: http://localhost/index.php/Special:Redirect/";><meta 
property="mw:articleNamespace" content="0"/><link rel="dc:replaces" 
resource="mwr:revision/0"/><meta property="dc:modified" 
content="2014-09-12T22:46:59.000Z"/><meta about="mwr:user/0" 
property="dc:title" content="MediaWiki default"/><link rel="dc:contributor" 
resource="mwr:user/0"/><meta property="mw:revisionSHA1" 
content="8e0aa2f2a7829587801db67d0424d9b447e09867"/><meta 
property="dc:description" content=""/><meta property="mw:parsoidVersion" 
content="0"/><link rel="dc:isVersionOf" 
href="http://localhost/index.php/Main_Page"/><title>Main_Page</title><base 
href="http://localhost/index.php/"/><link rel="stylesheet" 
href="//localhost/load.php?modules=mediawiki.legacy.commonPrint,shared|mediawiki.skinning.elements|mediawiki.skinning.content|mediawiki.skinning.interface|skins.vector.styles|site|mediawiki.skinning.content.parsoid&amp;only=styles&amp;debug=true&amp;skin=vector"/></head><body
 data-parsoid=\'{"dsr":[0,592,0,0]}\' lang="en" class="mw-content-ltr 
sitedir-ltr ltr mw-body mw-body-content mediawiki" dir="ltr"><p 
data-parsoid=\'{"dsr":[0,59,0,0]}\'><strong 
data-parsoid=\'{"stx":"html","dsr":[0,59,8,9]}\'>MediaWiki has been 
successfully installed.</strong></p>\n\n<p 
data-parsoid=\'{"dsr":[61,171,0,0]}\'>Consult the <a rel="mw:ExtLink" 
href="//meta.wikimedia.org/wiki/Help:Contents" 
data-parsoid=\'{"targetOff":114,"contentOffsets":[114,126],"dsr":[73,127,41,1]}\'>User\'s
 Guide</a> for information on using the wiki software.</p>\n\n<h2 
data-parsoid=\'{"dsr":[173,194,2,2]}\'> Getting started </h2>\n<ul 
data-parsoid=\'{"dsr":[195,592,0,0]}\'><li 
data-parsoid=\'{"dsr":[195,300,1,0]}\'> <a rel="mw:ExtLink" 
href="//www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings"
 
data-parsoid=\'{"targetOff":272,"contentOffsets":[272,299],"dsr":[197,300,75,1]}\'>Configuration
 settings list</a></li>\n<li data-parsoid=\'{"dsr":[301,373,1,0]}\'> <a 
rel="mw:ExtLink" href="//www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ" 
data-parsoid=\'{"targetOff":359,"contentOffsets":[359,372],"dsr":[303,373,56,1]}\'>MediaWiki
 FAQ</a></li>\n<li data-parsoid=\'{"dsr":[374,472,1,0]}\'> <a rel="mw:ExtLink" 
href="https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce"; 
data-parsoid=\'{"targetOff":441,"contentOffsets":[441,471],"dsr":[376,472,65,1]}\'>MediaWiki
 release mailing list</a></li>\n<li data-parsoid=\'{"dsr":[473,592,1,0]}\'> <a 
rel="mw:ExtLink" 
href="//www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources"
 
data-parsoid=\'{"targetOff":555,"contentOffsets":[555,591],"dsr":[475,592,80,1]}\'>Localise
 MediaWiki for your language</a></li></ul></body></html>',
                                })
@@ -405,7 +405,7 @@
 
                        it('should accept html with headers', function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/wt/')
+                               .post('v2/' + mockDomain + '/wt/')
                                .send({
                                        html: {
                                                headers: {
@@ -423,7 +423,7 @@
 
                        it('should allow a title in the url', function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/wt/Main_Page')
+                               .post('v2/' + mockDomain + '/wt/Main_Page')
                                .send({
                                        html: '<!DOCTYPE html>\n<html 
prefix="dc: http://purl.org/dc/terms/ mw: http://mediawiki.org/rdf/"; 
about="http://localhost/index.php/Special:Redirect/revision/1";><head 
prefix="mwr: http://localhost/index.php/Special:Redirect/";><meta 
property="mw:articleNamespace" content="0"/><link rel="dc:replaces" 
resource="mwr:revision/0"/><meta property="dc:modified" 
content="2014-09-12T22:46:59.000Z"/><meta about="mwr:user/0" 
property="dc:title" content="MediaWiki default"/><link rel="dc:contributor" 
resource="mwr:user/0"/><meta property="mw:revisionSHA1" 
content="8e0aa2f2a7829587801db67d0424d9b447e09867"/><meta 
property="dc:description" content=""/><meta property="mw:parsoidVersion" 
content="0"/><link rel="dc:isVersionOf" 
href="http://localhost/index.php/Main_Page"/><title>Main_Page</title><base 
href="http://localhost/index.php/"/><link rel="stylesheet" 
href="//localhost/load.php?modules=mediawiki.legacy.commonPrint,shared|mediawiki.skinning.elements|mediawiki.skinning.content|mediawiki.skinning.interface|skins.vector.styles|site|mediawiki.skinning.content.parsoid&amp;only=styles&amp;debug=true&amp;skin=vector"/></head><body
 data-parsoid=\'{"dsr":[0,592,0,0]}\' lang="en" class="mw-content-ltr 
sitedir-ltr ltr mw-body mw-body-content mediawiki" dir="ltr"><p 
data-parsoid=\'{"dsr":[0,59,0,0]}\'><strong 
data-parsoid=\'{"stx":"html","dsr":[0,59,8,9]}\'>MediaWiki has been 
successfully installed.</strong></p>\n\n<p 
data-parsoid=\'{"dsr":[61,171,0,0]}\'>Consult the <a rel="mw:ExtLink" 
href="//meta.wikimedia.org/wiki/Help:Contents" 
data-parsoid=\'{"targetOff":114,"contentOffsets":[114,126],"dsr":[73,127,41,1]}\'>User\'s
 Guide</a> for information on using the wiki software.</p>\n\n<h2 
data-parsoid=\'{"dsr":[173,194,2,2]}\'> Getting started </h2>\n<ul 
data-parsoid=\'{"dsr":[195,592,0,0]}\'><li 
data-parsoid=\'{"dsr":[195,300,1,0]}\'> <a rel="mw:ExtLink" 
href="//www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings"
 
data-parsoid=\'{"targetOff":272,"contentOffsets":[272,299],"dsr":[197,300,75,1]}\'>Configuration
 settings list</a></li>\n<li data-parsoid=\'{"dsr":[301,373,1,0]}\'> <a 
rel="mw:ExtLink" href="//www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ" 
data-parsoid=\'{"targetOff":359,"contentOffsets":[359,372],"dsr":[303,373,56,1]}\'>MediaWiki
 FAQ</a></li>\n<li data-parsoid=\'{"dsr":[374,472,1,0]}\'> <a rel="mw:ExtLink" 
href="https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce"; 
data-parsoid=\'{"targetOff":441,"contentOffsets":[441,471],"dsr":[376,472,65,1]}\'>MediaWiki
 release mailing list</a></li>\n<li data-parsoid=\'{"dsr":[473,592,1,0]}\'> <a 
rel="mw:ExtLink" 
href="//www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources"
 
data-parsoid=\'{"targetOff":555,"contentOffsets":[555,591],"dsr":[475,592,80,1]}\'>Localise
 MediaWiki for your language</a></li></ul></body></html>',
                                })
@@ -436,7 +436,7 @@
 
                        it('should allow a title in the original data', 
function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/wt/')
+                               .post('v2/' + mockDomain + '/wt/')
                                .send({
                                        html: '<!DOCTYPE html>\n<html 
prefix="dc: http://purl.org/dc/terms/ mw: http://mediawiki.org/rdf/"; 
about="http://localhost/index.php/Special:Redirect/revision/1";><head 
prefix="mwr: http://localhost/index.php/Special:Redirect/";><meta 
property="mw:articleNamespace" content="0"/><link rel="dc:replaces" 
resource="mwr:revision/0"/><meta property="dc:modified" 
content="2014-09-12T22:46:59.000Z"/><meta about="mwr:user/0" 
property="dc:title" content="MediaWiki default"/><link rel="dc:contributor" 
resource="mwr:user/0"/><meta property="mw:revisionSHA1" 
content="8e0aa2f2a7829587801db67d0424d9b447e09867"/><meta 
property="dc:description" content=""/><meta property="mw:parsoidVersion" 
content="0"/><link rel="dc:isVersionOf" 
href="http://localhost/index.php/Main_Page"/><title>Main_Page</title><base 
href="http://localhost/index.php/"/><link rel="stylesheet" 
href="//localhost/load.php?modules=mediawiki.legacy.commonPrint,shared|mediawiki.skinning.elements|mediawiki.skinning.content|mediawiki.skinning.interface|skins.vector.styles|site|mediawiki.skinning.content.parsoid&amp;only=styles&amp;debug=true&amp;skin=vector"/></head><body
 data-parsoid=\'{"dsr":[0,592,0,0]}\' lang="en" class="mw-content-ltr 
sitedir-ltr ltr mw-body mw-body-content mediawiki" dir="ltr"><p 
data-parsoid=\'{"dsr":[0,59,0,0]}\'><strong 
data-parsoid=\'{"stx":"html","dsr":[0,59,8,9]}\'>MediaWiki has been 
successfully installed.</strong></p>\n\n<p 
data-parsoid=\'{"dsr":[61,171,0,0]}\'>Consult the <a rel="mw:ExtLink" 
href="//meta.wikimedia.org/wiki/Help:Contents" 
data-parsoid=\'{"targetOff":114,"contentOffsets":[114,126],"dsr":[73,127,41,1]}\'>User\'s
 Guide</a> for information on using the wiki software.</p>\n\n<h2 
data-parsoid=\'{"dsr":[173,194,2,2]}\'> Getting started </h2>\n<ul 
data-parsoid=\'{"dsr":[195,592,0,0]}\'><li 
data-parsoid=\'{"dsr":[195,300,1,0]}\'> <a rel="mw:ExtLink" 
href="//www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings"
 
data-parsoid=\'{"targetOff":272,"contentOffsets":[272,299],"dsr":[197,300,75,1]}\'>Configuration
 settings list</a></li>\n<li data-parsoid=\'{"dsr":[301,373,1,0]}\'> <a 
rel="mw:ExtLink" href="//www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ" 
data-parsoid=\'{"targetOff":359,"contentOffsets":[359,372],"dsr":[303,373,56,1]}\'>MediaWiki
 FAQ</a></li>\n<li data-parsoid=\'{"dsr":[374,472,1,0]}\'> <a rel="mw:ExtLink" 
href="https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce"; 
data-parsoid=\'{"targetOff":441,"contentOffsets":[441,471],"dsr":[376,472,65,1]}\'>MediaWiki
 release mailing list</a></li>\n<li data-parsoid=\'{"dsr":[473,592,1,0]}\'> <a 
rel="mw:ExtLink" 
href="//www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources"
 
data-parsoid=\'{"targetOff":555,"contentOffsets":[555,591],"dsr":[475,592,80,1]}\'>Localise
 MediaWiki for your language</a></li></ul></body></html>',
                                        original: {
@@ -452,7 +452,7 @@
 
                        it('should allow a revision id in the url', 
function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/wt/Main_Page/1')
+                               .post('v2/' + mockDomain + '/wt/Main_Page/1')
                                .send({
                                        html: '<!DOCTYPE html>\n<html 
prefix="dc: http://purl.org/dc/terms/ mw: http://mediawiki.org/rdf/"; 
about="http://localhost/index.php/Special:Redirect/revision/1";><head 
prefix="mwr: http://localhost/index.php/Special:Redirect/";><meta 
property="mw:articleNamespace" content="0"/><link rel="dc:replaces" 
resource="mwr:revision/0"/><meta property="dc:modified" 
content="2014-09-12T22:46:59.000Z"/><meta about="mwr:user/0" 
property="dc:title" content="MediaWiki default"/><link rel="dc:contributor" 
resource="mwr:user/0"/><meta property="mw:revisionSHA1" 
content="8e0aa2f2a7829587801db67d0424d9b447e09867"/><meta 
property="dc:description" content=""/><meta property="mw:parsoidVersion" 
content="0"/><link rel="dc:isVersionOf" 
href="http://localhost/index.php/Main_Page"/><title>Main_Page</title><base 
href="http://localhost/index.php/"/><link rel="stylesheet" 
href="//localhost/load.php?modules=mediawiki.legacy.commonPrint,shared|mediawiki.skinning.elements|mediawiki.skinning.content|mediawiki.skinning.interface|skins.vector.styles|site|mediawiki.skinning.content.parsoid&amp;only=styles&amp;debug=true&amp;skin=vector"/></head><body
 data-parsoid=\'{"dsr":[0,592,0,0]}\' lang="en" class="mw-content-ltr 
sitedir-ltr ltr mw-body mw-body-content mediawiki" dir="ltr"><p 
data-parsoid=\'{"dsr":[0,59,0,0]}\'><strong 
data-parsoid=\'{"stx":"html","dsr":[0,59,8,9]}\'>MediaWiki has been 
successfully installed.</strong></p>\n\n<p 
data-parsoid=\'{"dsr":[61,171,0,0]}\'>Consult the <a rel="mw:ExtLink" 
href="//meta.wikimedia.org/wiki/Help:Contents" 
data-parsoid=\'{"targetOff":114,"contentOffsets":[114,126],"dsr":[73,127,41,1]}\'>User\'s
 Guide</a> for information on using the wiki software.</p>\n\n<h2 
data-parsoid=\'{"dsr":[173,194,2,2]}\'> Getting started </h2>\n<ul 
data-parsoid=\'{"dsr":[195,592,0,0]}\'><li 
data-parsoid=\'{"dsr":[195,300,1,0]}\'> <a rel="mw:ExtLink" 
href="//www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings"
 
data-parsoid=\'{"targetOff":272,"contentOffsets":[272,299],"dsr":[197,300,75,1]}\'>Configuration
 settings list</a></li>\n<li data-parsoid=\'{"dsr":[301,373,1,0]}\'> <a 
rel="mw:ExtLink" href="//www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ" 
data-parsoid=\'{"targetOff":359,"contentOffsets":[359,372],"dsr":[303,373,56,1]}\'>MediaWiki
 FAQ</a></li>\n<li data-parsoid=\'{"dsr":[374,472,1,0]}\'> <a rel="mw:ExtLink" 
href="https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce"; 
data-parsoid=\'{"targetOff":441,"contentOffsets":[441,471],"dsr":[376,472,65,1]}\'>MediaWiki
 release mailing list</a></li>\n<li data-parsoid=\'{"dsr":[473,592,1,0]}\'> <a 
rel="mw:ExtLink" 
href="//www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources"
 
data-parsoid=\'{"targetOff":555,"contentOffsets":[555,591],"dsr":[475,592,80,1]}\'>Localise
 MediaWiki for your language</a></li></ul></body></html>',
                                })
@@ -465,7 +465,7 @@
 
                        it('should allow a revision id in the original data', 
function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/wt/')
+                               .post('v2/' + mockDomain + '/wt/')
                                .send({
                                        html: '<!DOCTYPE html>\n<html 
prefix="dc: http://purl.org/dc/terms/ mw: http://mediawiki.org/rdf/"; 
about="http://localhost/index.php/Special:Redirect/revision/1";><head 
prefix="mwr: http://localhost/index.php/Special:Redirect/";><meta 
property="mw:articleNamespace" content="0"/><link rel="dc:replaces" 
resource="mwr:revision/0"/><meta property="dc:modified" 
content="2014-09-12T22:46:59.000Z"/><meta about="mwr:user/0" 
property="dc:title" content="MediaWiki default"/><link rel="dc:contributor" 
resource="mwr:user/0"/><meta property="mw:revisionSHA1" 
content="8e0aa2f2a7829587801db67d0424d9b447e09867"/><meta 
property="dc:description" content=""/><meta property="mw:parsoidVersion" 
content="0"/><link rel="dc:isVersionOf" 
href="http://localhost/index.php/Main_Page"/><title>Main_Page</title><base 
href="http://localhost/index.php/"/><link rel="stylesheet" 
href="//localhost/load.php?modules=mediawiki.legacy.commonPrint,shared|mediawiki.skinning.elements|mediawiki.skinning.content|mediawiki.skinning.interface|skins.vector.styles|site|mediawiki.skinning.content.parsoid&amp;only=styles&amp;debug=true&amp;skin=vector"/></head><body
 data-parsoid=\'{"dsr":[0,592,0,0]}\' lang="en" class="mw-content-ltr 
sitedir-ltr ltr mw-body mw-body-content mediawiki" dir="ltr"><p 
data-parsoid=\'{"dsr":[0,59,0,0]}\'><strong 
data-parsoid=\'{"stx":"html","dsr":[0,59,8,9]}\'>MediaWiki has been 
successfully installed.</strong></p>\n\n<p 
data-parsoid=\'{"dsr":[61,171,0,0]}\'>Consult the <a rel="mw:ExtLink" 
href="//meta.wikimedia.org/wiki/Help:Contents" 
data-parsoid=\'{"targetOff":114,"contentOffsets":[114,126],"dsr":[73,127,41,1]}\'>User\'s
 Guide</a> for information on using the wiki software.</p>\n\n<h2 
data-parsoid=\'{"dsr":[173,194,2,2]}\'> Getting started </h2>\n<ul 
data-parsoid=\'{"dsr":[195,592,0,0]}\'><li 
data-parsoid=\'{"dsr":[195,300,1,0]}\'> <a rel="mw:ExtLink" 
href="//www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings"
 
data-parsoid=\'{"targetOff":272,"contentOffsets":[272,299],"dsr":[197,300,75,1]}\'>Configuration
 settings list</a></li>\n<li data-parsoid=\'{"dsr":[301,373,1,0]}\'> <a 
rel="mw:ExtLink" href="//www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ" 
data-parsoid=\'{"targetOff":359,"contentOffsets":[359,372],"dsr":[303,373,56,1]}\'>MediaWiki
 FAQ</a></li>\n<li data-parsoid=\'{"dsr":[374,472,1,0]}\'> <a rel="mw:ExtLink" 
href="https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce"; 
data-parsoid=\'{"targetOff":441,"contentOffsets":[441,471],"dsr":[376,472,65,1]}\'>MediaWiki
 release mailing list</a></li>\n<li data-parsoid=\'{"dsr":[473,592,1,0]}\'> <a 
rel="mw:ExtLink" 
href="//www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources"
 
data-parsoid=\'{"targetOff":555,"contentOffsets":[555,591],"dsr":[475,592,80,1]}\'>Localise
 MediaWiki for your language</a></li></ul></body></html>',
                                        original: {
@@ -481,7 +481,7 @@
 
                        it('should accept original wikitext as src', 
function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/wt/')
+                               .post('v2/' + mockDomain + '/wt/')
                                .send({
                                        html: '<!DOCTYPE html>\n<html 
prefix="dc: http://purl.org/dc/terms/ mw: http://mediawiki.org/rdf/"; 
about="http://localhost/index.php/Special:Redirect/revision/1";><head 
prefix="mwr: http://localhost/index.php/Special:Redirect/";><meta 
property="mw:articleNamespace" content="0"/><link rel="dc:replaces" 
resource="mwr:revision/0"/><meta property="dc:modified" 
content="2014-09-12T22:46:59.000Z"/><meta about="mwr:user/0" 
property="dc:title" content="MediaWiki default"/><link rel="dc:contributor" 
resource="mwr:user/0"/><meta property="mw:revisionSHA1" 
content="8e0aa2f2a7829587801db67d0424d9b447e09867"/><meta 
property="dc:description" content=""/><meta property="mw:parsoidVersion" 
content="0"/><link rel="dc:isVersionOf" 
href="http://localhost/index.php/Main_Page"/><title>Main_Page</title><base 
href="http://localhost/index.php/"/><link rel="stylesheet" 
href="//localhost/load.php?modules=mediawiki.legacy.commonPrint,shared|mediawiki.skinning.elements|mediawiki.skinning.content|mediawiki.skinning.interface|skins.vector.styles|site|mediawiki.skinning.content.parsoid&amp;only=styles&amp;debug=true&amp;skin=vector"/></head><body
 data-parsoid=\'{"dsr":[0,592,0,0]}\' lang="en" class="mw-content-ltr 
sitedir-ltr ltr mw-body mw-body-content mediawiki" dir="ltr"><p 
data-parsoid=\'{"dsr":[0,59,0,0]}\'><strong 
data-parsoid=\'{"stx":"html","dsr":[0,59,8,9]}\'>MediaWiki has been 
successfully installed.</strong></p>\n\n<p 
data-parsoid=\'{"dsr":[61,171,0,0]}\'>Consult the <a rel="mw:ExtLink" 
href="//meta.wikimedia.org/wiki/Help:Contents" 
data-parsoid=\'{"targetOff":114,"contentOffsets":[114,126],"dsr":[73,127,41,1]}\'>User\'s
 Guide</a> for information on using the wiki software.</p>\n\n<h2 
data-parsoid=\'{"dsr":[173,194,2,2]}\'> Getting started </h2>\n<ul 
data-parsoid=\'{"dsr":[195,592,0,0]}\'><li 
data-parsoid=\'{"dsr":[195,300,1,0]}\'> <a rel="mw:ExtLink" 
href="//www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings"
 
data-parsoid=\'{"targetOff":272,"contentOffsets":[272,299],"dsr":[197,300,75,1]}\'>Configuration
 settings list</a></li>\n<li data-parsoid=\'{"dsr":[301,373,1,0]}\'> <a 
rel="mw:ExtLink" href="//www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ" 
data-parsoid=\'{"targetOff":359,"contentOffsets":[359,372],"dsr":[303,373,56,1]}\'>MediaWiki
 FAQ</a></li>\n<li data-parsoid=\'{"dsr":[374,472,1,0]}\'> <a rel="mw:ExtLink" 
href="https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce"; 
data-parsoid=\'{"targetOff":441,"contentOffsets":[441,471],"dsr":[376,472,65,1]}\'>MediaWiki
 release mailing list</a></li>\n<li data-parsoid=\'{"dsr":[473,592,1,0]}\'> <a 
rel="mw:ExtLink" 
href="//www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources"
 
data-parsoid=\'{"targetOff":555,"contentOffsets":[555,591],"dsr":[475,592,80,1]}\'>Localise
 MediaWiki for your language</a></li></ul></body></html>',
                                        original: {
@@ -502,7 +502,7 @@
 
                        it('should accept original html for selser', 
function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/wt/')
+                               .post('v2/' + mockDomain + '/wt/')
                                .send({
                                        html: '<!DOCTYPE html>\n<html 
prefix="dc: http://purl.org/dc/terms/ mw: http://mediawiki.org/rdf/"; 
about="http://localhost/index.php/Special:Redirect/revision/1";><head 
prefix="mwr: http://localhost/index.php/Special:Redirect/";><meta 
property="mw:articleNamespace" content="0"/><link rel="dc:replaces" 
resource="mwr:revision/0"/><meta property="dc:modified" 
content="2014-09-12T22:46:59.000Z"/><meta about="mwr:user/0" 
property="dc:title" content="MediaWiki default"/><link rel="dc:contributor" 
resource="mwr:user/0"/><meta property="mw:revisionSHA1" 
content="8e0aa2f2a7829587801db67d0424d9b447e09867"/><meta 
property="dc:description" content=""/><meta property="mw:parsoidVersion" 
content="0"/><link rel="dc:isVersionOf" 
href="http://localhost/index.php/Main_Page"/><title>Main_Page</title><base 
href="http://localhost/index.php/"/><link rel="stylesheet" 
href="//localhost/load.php?modules=mediawiki.legacy.commonPrint,shared|mediawiki.skinning.elements|mediawiki.skinning.content|mediawiki.skinning.interface|skins.vector.styles|site|mediawiki.skinning.content.parsoid&amp;only=styles&amp;debug=true&amp;skin=vector"/></head><body
 data-parsoid=\'{"dsr":[0,592,0,0]}\' lang="en" class="mw-content-ltr 
sitedir-ltr ltr mw-body mw-body-content mediawiki" dir="ltr"><p 
data-parsoid=\'{"dsr":[0,59,0,0]}\'><strong 
data-parsoid=\'{"stx":"html","dsr":[0,59,8,9]}\'>MediaWiki has been 
successfully installed.</strong></p>\n\n<p 
data-parsoid=\'{"dsr":[61,171,0,0]}\'>Consult the <a rel="mw:ExtLink" 
href="//meta.wikimedia.org/wiki/Help:Contents" 
data-parsoid=\'{"targetOff":114,"contentOffsets":[114,126],"dsr":[73,127,41,1]}\'>User\'s
 Guide</a> for information on using the wiki software.</p>\n\n<h2 
data-parsoid=\'{"dsr":[173,194,2,2]}\'> Getting started </h2>\n<ul 
data-parsoid=\'{"dsr":[195,592,0,0]}\'><li 
data-parsoid=\'{"dsr":[195,300,1,0]}\'> <a rel="mw:ExtLink" 
href="//www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings"
 
data-parsoid=\'{"targetOff":272,"contentOffsets":[272,299],"dsr":[197,300,75,1]}\'>Configuration
 settings list</a></li>\n<li data-parsoid=\'{"dsr":[301,373,1,0]}\'> <a 
rel="mw:ExtLink" href="//www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ" 
data-parsoid=\'{"targetOff":359,"contentOffsets":[359,372],"dsr":[303,373,56,1]}\'>MediaWiki
 FAQ</a></li>\n<li data-parsoid=\'{"dsr":[374,472,1,0]}\'> <a rel="mw:ExtLink" 
href="https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce"; 
data-parsoid=\'{"targetOff":441,"contentOffsets":[441,471],"dsr":[376,472,65,1]}\'>MediaWiki
 release mailing list</a></li>\n<li data-parsoid=\'{"dsr":[473,592,1,0]}\'> <a 
rel="mw:ExtLink" 
href="//www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources"
 
data-parsoid=\'{"targetOff":555,"contentOffsets":[555,591],"dsr":[475,592,80,1]}\'>Localise
 MediaWiki for your language</a></li></ul></body></html>',
                                        original: {
@@ -534,7 +534,7 @@
 
                        it('should return http 400 if supplied data-parsoid is 
empty', function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/wt/')
+                               .post('v2/' + mockDomain + '/wt/')
                                .send({
                                        html: 
'<html><head></head><body><p>hi</p></body></html>',
                                        original: {
@@ -558,7 +558,7 @@
 
                        it('should return http 400 if supplied data-parsoid is 
a string', function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/wt/')
+                               .post('v2/' + mockDomain + '/wt/')
                                .send({
                                        html: 
'<html><head></head><body><p>hi</p></body></html>',
                                        original: {
@@ -597,7 +597,7 @@
                                // The oldid is used to fetch wikitext, but if 
wikitext is provided
                                // (as in this test), it is not used. So, for 
testing purposes,
                                // we can use any old random id, as long as 
something is present.
-                               .post('v2/' + mockHost + '/wt/Junk_Page/1234')
+                               .post('v2/' + mockDomain + '/wt/Junk_Page/1234')
                                .send({
                                        html: "<html><body id=\"mwAA\"><div 
id=\"mwBB\">Selser test</div></body></html>",
                                        original: {
@@ -630,7 +630,7 @@
                                // New and old html are identical, which should 
produce no diffs
                                // and reuse the original wikitext.
                                request(api)
-                               .post('v2/' + mockHost + '/wt/')
+                               .post('v2/' + mockDomain + '/wt/')
                                .send({
                                        html: "<html><body id=\"mwAA\"><div 
id=\"mwBB\">Selser test</div></body></html>",
                                        original: {
@@ -662,7 +662,7 @@
                                // TemplateFetch for the source (no revision id 
provided),
                                // it should fallback to non-selective 
serialization.
                                request(api)
-                               .post('v2/' + mockHost + '/wt/')
+                               .post('v2/' + mockDomain + '/wt/')
                                .send({
                                        html: "<html><body id=\"mwAA\"><div 
id=\"mwBB\">Selser test</div></body></html>",
                                        original: {
@@ -690,7 +690,7 @@
 
                        it('should apply data-parsoid to duplicated ids', 
function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/wt/')
+                               .post('v2/' + mockDomain + '/wt/')
                                .send({
                                        html: "<html><body id=\"mwAA\"><div 
id=\"mwBB\">data-parsoid test</div><div id=\"mwBB\">data-parsoid 
test</div></body></html>",
                                        original: {
@@ -718,7 +718,7 @@
 
                        it('should apply extra normalizations', function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/wt/')
+                               .post('v2/' + mockDomain + '/wt/')
                                .send({
                                        html: '<h2></h2>',
                                        scrubWikitext: true,
@@ -734,7 +734,7 @@
 
                        it('should suppress extra normalizations', 
function(done) {
                                request(api)
-                               .post('v2/' + mockHost + '/wt/')
+                               .post('v2/' + mockDomain + '/wt/')
                                .send({
                                        html: '<h2></h2>',
                                        original: { title: 'Doesnotexist' },
diff --git a/tests/mocha/apitest.localsettings.js 
b/tests/mocha/apitest.localsettings.js
index 16b215b..9078eb9 100644
--- a/tests/mocha/apitest.localsettings.js
+++ b/tests/mocha/apitest.localsettings.js
@@ -10,7 +10,11 @@
 exports.setup = function(parsoidConfig) {
        // The URL of your MediaWiki API endpoint.
        if (process.env.PARSOID_MOCKAPI_URL) {
-               parsoidConfig.setMwApi('localhost', { uri: 
process.env.PARSOID_MOCKAPI_URL });
+               parsoidConfig.setMwApi({
+                       prefix: 'mock.prefix',
+                       domain: 'mock.domain',
+                       uri: process.env.PARSOID_MOCKAPI_URL,
+               });
        }
 
        // We pre-define wikipedias as 'enwiki', 'dewiki' etc. Similarly
diff --git a/tests/parserTests.js b/tests/parserTests.js
index f84c30f..c987e02 100755
--- a/tests/parserTests.js
+++ b/tests/parserTests.js
@@ -1660,13 +1660,21 @@
                parsoidConfig.initMwApiMap();
 
                // Send all requests to the mock API server.
-               parsoidConfig.mwApiMap.forEach(function(apiConf, prefix) {
-                       parsoidConfig.setMwApi(prefix, { uri: mockAPIServerURL 
});
+               parsoidConfig.mwApiMap.forEach(function(apiConf) {
+                       parsoidConfig.setMwApi({
+                               prefix: apiConf.prefix,
+                               domain: apiConf.domain,
+                               uri: mockAPIServerURL,
+                       });
                });
 
                // This isn't part of the sitematrix but the
                // "Check noCommafy in formatNum" test depends on it.
-               parsoidConfig.setMwApi('be-taraskwiki', { uri: mockAPIServerURL 
});
+               parsoidConfig.setMwApi({
+                       prefix: 'be-taraskwiki',
+                       domain: 'be-tarask.wikipedia.org',
+                       uri: mockAPIServerURL,
+               });
        };
 
        var parsoidConfig = new ParsoidConfig({ setup: setup }, options);
diff --git a/tests/rttest.localsettings.js b/tests/rttest.localsettings.js
index 7c5f587..bc2b083 100644
--- a/tests/rttest.localsettings.js
+++ b/tests/rttest.localsettings.js
@@ -10,7 +10,11 @@
 exports.setup = function(parsoidConfig) {
        // The URL of your MediaWiki API endpoint.
        if (process.env.PARSOID_MOCKAPI_URL) {
-               parsoidConfig.setMwApi('customwiki', { uri: 
process.env.PARSOID_MOCKAPI_URL });
+               parsoidConfig.setMwApi({
+                       prefix: 'customwiki',
+                       domain: 'customwiki',
+                       uri: process.env.PARSOID_MOCKAPI_URL,
+               });
        }
 
        // We pre-define wikipedias as 'enwiki', 'dewiki' etc. Similarly

-- 
To view, visit https://gerrit.wikimedia.org/r/232849
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie07743e6a02c5fb66f4e83ccc944c4a56ec36bc0
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: Arlolra <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to