Merge branch 'stable-3.0' into stable-3.1
* stable-3.0: Document the getConfig()-method in the plugin's restApi interface Add getConfig() method to plugin restApi interface Change-Id: I4ac0453bbabb576c94b24455d90d9f3e3bdfbe9a
This commit is contained in:
@@ -25,6 +25,17 @@ Get server version.
|
|||||||
.Returns
|
.Returns
|
||||||
- Promise<string>
|
- Promise<string>
|
||||||
|
|
||||||
|
== getConfig
|
||||||
|
`repoApi.getConfig()`
|
||||||
|
|
||||||
|
Get server config.
|
||||||
|
|
||||||
|
.Params
|
||||||
|
- None
|
||||||
|
|
||||||
|
.Returns
|
||||||
|
- Promise<Object>
|
||||||
|
|
||||||
== get
|
== get
|
||||||
`repoApi.get(url)`
|
`repoApi.get(url)`
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,10 @@
|
|||||||
return getRestApi().getVersion();
|
return getRestApi().getVersion();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GrPluginRestApi.prototype.getConfig = function() {
|
||||||
|
return getRestApi().getConfig();
|
||||||
|
};
|
||||||
|
|
||||||
GrPluginRestApi.prototype.invalidateReposCache = function() {
|
GrPluginRestApi.prototype.invalidateReposCache = function() {
|
||||||
getRestApi().invalidateReposCache();
|
getRestApi().invalidateReposCache();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ limitations under the License.
|
|||||||
send: sendStub,
|
send: sendStub,
|
||||||
getLoggedIn: sandbox.stub(),
|
getLoggedIn: sandbox.stub(),
|
||||||
getVersion: sandbox.stub(),
|
getVersion: sandbox.stub(),
|
||||||
|
getConfig: sandbox.stub(),
|
||||||
};
|
};
|
||||||
stub('gr-rest-api-interface', Object.keys(restApiStub).reduce((a, k) => {
|
stub('gr-rest-api-interface', Object.keys(restApiStub).reduce((a, k) => {
|
||||||
a[k] = (...args) => restApiStub[k](...args);
|
a[k] = (...args) => restApiStub[k](...args);
|
||||||
@@ -135,12 +136,20 @@ limitations under the License.
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getConfig', () => {
|
test('getVersion', () => {
|
||||||
restApiStub.getVersion.returns(Promise.resolve('foo bar'));
|
restApiStub.getVersion.returns(Promise.resolve('foo bar'));
|
||||||
return instance.getVersion().then(result => {
|
return instance.getVersion().then(result => {
|
||||||
assert.isTrue(restApiStub.getVersion.calledOnce);
|
assert.isTrue(restApiStub.getVersion.calledOnce);
|
||||||
assert.equal(result, 'foo bar');
|
assert.equal(result, 'foo bar');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('getConfig', () => {
|
||||||
|
restApiStub.getConfig.returns(Promise.resolve('foo bar'));
|
||||||
|
return instance.getConfig().then(result => {
|
||||||
|
assert.isTrue(restApiStub.getConfig.calledOnce);
|
||||||
|
assert.equal(result, 'foo bar');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user