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
parent 179b33e3c1
commit 1f471feba2
2 changed files with 3 additions and 12 deletions

View File

@ -34,13 +34,6 @@ loop.Client = (function($) {
}
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.
*
@ -124,8 +117,7 @@ loop.Client = (function($) {
cb(null, this._validate(urlData, expectedCallUrlProperties));
var expiresHours = this._hoursToSeconds(urlData.expiresAt);
this.mozLoop.noteCallUrlExpiry(expiresHours);
this.mozLoop.noteCallUrlExpiry(urlData.expiresAt);
} catch (err) {
console.log("Error requesting call info", err);
cb(err);

View File

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