Permalink
Browse files

Adding UT.

  • Loading branch information...
1 parent 1db66d9 commit 702534728761e6d971480901c106cd97f3b872d1 Andre Rodrigues committed Oct 13, 2012
Showing with 24 additions and 2 deletions.
  1. +4 −2 lib/services/serviceBus/wrap.js
  2. +20 −0 test/azure-tests.js
@@ -39,9 +39,11 @@ exports = module.exports = Wrap;
* @param {string} acsHost The access control host.
* @param {string} issuer The service bus issuer.
* @param {string} accessKey The service bus issuer password.
-* @param {string} host The host for the service.
*/
-function Wrap(acsHost, issuer, accessKey, host) {
+function Wrap(acsHost, issuer, accessKey) {
+ this.acsHost = acsHost;
+ this.issuer = issuer;
+ this.accessKey = accessKey;
this.wrapTokenManager = new WrapTokenManager(acsHost, issuer, accessKey, host);
}
View
@@ -235,4 +235,24 @@ suite('azure', function () {
done();
});
+
+test('MissingServiceBusIssuerAndWrapNamespace', function (done) {
+ delete process.env[ServiceClient.EnvironmentVariables.AZURE_WRAP_NAMESPACE];
+ delete process.env[ServiceClient.EnvironmentVariables.AZURE_SERVICEBUS_ISSUER];
+
+ process.env[ServiceClient.EnvironmentVariables.AZURE_SERVICEBUS_NAMESPACE] = environmentServiceBusNamespace;
+ process.env[ServiceClient.EnvironmentVariables.AZURE_SERVICEBUS_ACCESS_KEY] = environmentServiceBusAccessKey;
+
+ // Create service bus client without passing any credentials
+ var serviceBusService = azure.createServiceBusService();
+
+ // set correctly
+ assert.equal(serviceBusService.authenticationProvider.acsHost, environmentServiceBusNamespace + ServiceClient.DEFAULT_WRAP_NAMESPACE_SUFFIX);
+ assert.equal(serviceBusService.authenticationProvider.accessKey, environmentServiceBusAccessKey);
+
+ // defaulted correctly
+ assert.equal(serviceBusService.authenticationProvider.issuer, ServiceClient.DEFAULT_SERVICEBUS_ISSUER);
+
+ done();
+ });
});

0 comments on commit 7025347

Please sign in to comment.