Commit 2497981a authored by Piotr Gawron's avatar Piotr Gawron
Browse files

mock for isSessionValid

parent 93fc622e
......@@ -180,12 +180,12 @@ ServerConnector.sendGetRequest = function (url, description) {
*/
ServerConnector.isSessionValid = function () {
var self = this;
return self._sendRequest({url: this.isSessionValidUrl()}).then(function () {
return true;
return self._sendRequest({method: "GET", url: this.isSessionValidUrl()}).then(function (content) {
return JSON.parse(content).login === self.getSessionData(null).getLogin();
}).catch(function (error) {
if (error instanceof NetworkError) {
if (error.statusCode === HttpStatus.FORBIDDEN || error.statusCode === HttpStatus.UNAUTHORIZED) {
return false;
return self.getSessionData(null).getLogin() === "anonymous";
}
}
return Promise.reject(error);
......
......@@ -46,6 +46,9 @@ function encodeParams(params) {
ServerConnectorMock.checkIfUserLogoutFromDifferentTab = function () {
logger.debug("checkIfUserLogoutFromDifferentTab is ignored");
};
ServerConnectorMock.isSessionValid = function () {
return Promise.resolve(true);
};
ServerConnectorMock._sendRequest = function (params) {
var self = this;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment