This repository has been archived by the owner on Dec 12, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration tests describing Client API scenarios
- Loading branch information
Luka Skukan
committed
Dec 13, 2016
1 parent
7278677
commit b441dab
Showing
1 changed file
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
'use strict'; | ||
|
||
var common = require('../common'); | ||
var helpers = require('./helpers'); | ||
var assert = common.assert; | ||
|
||
var WebConfig = require('../../lib/resource/WebConfig'); | ||
|
||
describe('WebConfig', function() { | ||
var client; | ||
var app; | ||
var webConfig; | ||
var signingKey; | ||
|
||
before(function(done) { | ||
helpers.getClient(function(_client) { | ||
client = _client; | ||
signingKey = client._dataStore.requestExecutor.options.client.apiKey.secret; | ||
|
||
client.createApplication({ name: helpers.uniqId()}, function(err, _app) { | ||
if (err) { | ||
return done(err); | ||
} | ||
|
||
app = _app; | ||
app.getWebConfig(function(err, _webConfig) { | ||
if (err) { | ||
return done(err); | ||
} | ||
|
||
webConfig = _webConfig; | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
after(function(done) { | ||
app.delete(function(err) { | ||
if (err) { | ||
return done(err); | ||
} | ||
|
||
done(); | ||
}); | ||
}); | ||
|
||
it('should be get-able', function() { | ||
assert.instanceOf(webConfig, WebConfig); | ||
}); | ||
|
||
it('should have the application uri', function() { | ||
assert.isOk(webConfig.dnsLabel); | ||
}); | ||
|
||
it('should be possible to enable it', function(done) { | ||
webConfig.status = 'ENABLED'; | ||
|
||
webConfig.save(function(err, _webConfig) { | ||
if (err) { | ||
return done(err); | ||
} | ||
|
||
assert.equal(_webConfig.status, 'ENABLED'); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should be possible to disable it', function(done) { | ||
webConfig.status = 'DISABLED'; | ||
|
||
webConfig.save(function(err, _webConfig) { | ||
if (err) { | ||
return done(err); | ||
} | ||
|
||
assert.equal(_webConfig.status, 'DISABLED'); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should be possible to edit it', function(done) { | ||
var oldRegisterStatus = webConfig.register.enabled; | ||
var newRegisterStatus = !oldRegisterStatus; | ||
|
||
webConfig.register.enabled = newRegisterStatus; | ||
|
||
webConfig.save(function(err, _webConfig) { | ||
if (err) { | ||
return done(err); | ||
} | ||
|
||
assert.equal(_webConfig.register.enabled, newRegisterStatus); | ||
done(); | ||
}); | ||
}); | ||
}); |