Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding UT.

  • Loading branch information...
commit 702534728761e6d971480901c106cd97f3b872d1 1 parent 1db66d9
André Rodrigues andrerod authored
Showing with 24 additions and 2 deletions.
  1. +4 −2 lib/services/serviceBus/wrap.js
  2. +20 −0 test/azure-tests.js
6 lib/services/serviceBus/wrap.js
View
@@ -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);
}
20 test/azure-tests.js
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();
+ });
});
Please sign in to comment.
Something went wrong with that request. Please try again.