Bug 1038675 expiresAt parameter of /call-url/ response has changed from hours to seconds with the latest server version (Loop desktop client doesn't register on startup of browser). r=nperriault

This commit is contained in:
Mark Banner 2014-07-16 15:15:08 +01:00
Родитель 54c330ca18
Коммит 972161bfff
2 изменённых файлов: 3 добавлений и 12 удалений

Просмотреть файл

@ -34,13 +34,6 @@ loop.Client = (function($) {
} }
Client.prototype = { Client.prototype = {
/**
* Converts from hours to seconds
*/
_hoursToSeconds: function(value) {
return value * 60 * 60;
},
/** /**
* Validates a data object to confirm it has the specified properties. * Validates a data object to confirm it has the specified properties.
* *
@ -124,8 +117,7 @@ loop.Client = (function($) {
cb(null, this._validate(urlData, expectedCallUrlProperties)); cb(null, this._validate(urlData, expectedCallUrlProperties));
var expiresHours = this._hoursToSeconds(urlData.expiresAt); this.mozLoop.noteCallUrlExpiry(urlData.expiresAt);
this.mozLoop.noteCallUrlExpiry(expiresHours);
} catch (err) { } catch (err) {
console.log("Error requesting call info", err); console.log("Error requesting call info", err);
cb(err); cb(err);

Просмотреть файл

@ -91,7 +91,7 @@ describe("loop.Client", function() {
it("should note the call url expiry when the request succeeds", function() { it("should note the call url expiry when the request succeeds", function() {
var callUrlData = { var callUrlData = {
"callUrl": "fakeCallUrl", "callUrl": "fakeCallUrl",
"expiresAt": 60 "expiresAt": 6000
}; };
// Sets up the hawkRequest stub to trigger the callback with no error // Sets up the hawkRequest stub to trigger the callback with no error
@ -101,10 +101,9 @@ describe("loop.Client", function() {
client.requestCallUrl("foo", callback); client.requestCallUrl("foo", callback);
// expiresAt is in hours, and noteCallUrlExpiry wants seconds.
sinon.assert.calledOnce(mozLoop.noteCallUrlExpiry); sinon.assert.calledOnce(mozLoop.noteCallUrlExpiry);
sinon.assert.calledWithExactly(mozLoop.noteCallUrlExpiry, sinon.assert.calledWithExactly(mozLoop.noteCallUrlExpiry,
60 * 60 * 60); 6000);
}); });
it("should send an error when the request fails", function() { it("should send an error when the request fails", function() {