diff --git a/cloudron.js b/cloudron.js index 044348e..92ac81a 100644 --- a/cloudron.js +++ b/cloudron.js @@ -317,6 +317,12 @@ Cloudron.prototype.reboot = function () { this.waitForBox(); }; +Cloudron.prototype.checkTimeZone = function (tz) { + var res = request.get(this._origin + '/api/v1/settings/time_zone').query({ access_token: this._credentials.accessToken }).end(); + common.verifyResponse2xx(res, 'Could not query timezone'); + if (tz !== res.body.timeZone) throw new Error('timezone does not match. expecting: %s got %s', tz, result.body.timeZone); +}; + Cloudron.prototype.checkA = function (callback) { var that = this; dns.resolve4(this._box.domain, function (error, records) { diff --git a/test/new-user-test.js b/test/new-user-test.js index 901b444..a926258 100644 --- a/test/new-user-test.js +++ b/test/new-user-test.js @@ -63,6 +63,10 @@ describe('Appstore new user flow', function () { cloudron.setCredentials(owner.password, token); }); + it('can get the timezone', function () { + cloudron.checkTimezone('America/New_York'); + }); + var location = 'haste' + (Math.random() * 10000).toFixed(); it('can install app', function () { var manifest = appStore.getManifest('com.hastebin.cloudronapp', '0.3.0');