mirror of
https://github.com/azure/login.git
synced 2026-03-12 18:07:08 -04:00
* Added no subscription support * Added L0s * added no subcriptions login support * test changes Co-authored-by: Ganesh S <ganeshs@CBREV-KESTUR.redmond.corp.microsoft.com> Co-authored-by: aksm-ms <58936966+aksm-ms@users.noreply.github.com>
25 lines
1.1 KiB
TypeScript
25 lines
1.1 KiB
TypeScript
import ScriptBuilder from "../../../src/PowerShell/Utilities/ScriptBuilder";
|
|
import Constants from "../../../src/PowerShell/Constants";
|
|
|
|
describe("Getting AzLogin PS script" , () => {
|
|
const scheme = Constants.ServicePrincipal;
|
|
let args: any = {
|
|
servicePrincipalId: "service-principal-id",
|
|
servicePrincipalKey: "service-principal-key",
|
|
environment: "environment",
|
|
scopeLevel: Constants.Subscription,
|
|
subscriptionId: "subId",
|
|
allowNoSubscriptionsLogin: true
|
|
}
|
|
|
|
test("PS script should not set context while passing allowNoSubscriptionsLogin as true", () => {
|
|
const loginScript = new ScriptBuilder().getAzPSLoginScript(scheme, "tenant-id", args);
|
|
expect(loginScript.includes("Set-AzContext -SubscriptionId")).toBeFalsy();
|
|
});
|
|
|
|
test("PS script should set context while passing allowNoSubscriptionsLogin as false", () => {
|
|
args["allowNoSubscriptionsLogin"] = false;
|
|
const loginScript = new ScriptBuilder().getAzPSLoginScript(scheme, "tenant-id", args);
|
|
expect(loginScript.includes("Set-AzContext -SubscriptionId")).toBeTruthy();
|
|
});
|
|
}); |