Skip to content

Commit 7dc2c2a

Browse files
Fixing typo and adding additional tests to validate passwordbox length (re: #187) (#548)
1 parent d547257 commit 7dc2c2a

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

arm-ttk/testcases/CreateUIDefinition/PasswordBoxes-Must-Have-Min-Length.test.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ foreach ($pwb in $passwordBoxes) { # Loop over each password box
3636
}
3737

3838
try { # If it did,
39-
$constraintWasRegex = [Regex]::new($textbox.constraints.regex) # try to cast to a regex
39+
$constraintWasRegex = [Regex]::new($pwb.constraints.regex) # try to cast to a regex
4040
$hasLengthConstraint = $lengthConstraintRegex.Matches($pwb.constraints.regex)
4141

4242
if (-not $hasLengthConstraint) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#",
3+
"handler": "Microsoft.Compute.MultiVm",
4+
"version": "0.1.2-preview",
5+
"parameters": {
6+
"basics": [
7+
{
8+
"name": "adminPassword",
9+
"type": "Microsoft.Common.PasswordBox",
10+
"label": {
11+
"password": "password",
12+
"confirmPassword": "Confirm password"
13+
},
14+
"constraints": {
15+
"required": true,
16+
"regex": "(?=.{12,})((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])|(?=.*\\d)(?=.*[a-zA-Z])(?=.*[\\W_])|(?=.*[a-z])(?=.*[A-Z])(?=.*[\\W_])).*",
17+
"validationMessage": "Password must be at least 12 characters long"
18+
},
19+
"options": {
20+
"hideConfirmation": false
21+
}
22+
}
23+
],
24+
"steps": []
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#",
3+
"handler": "Microsoft.Compute.MultiVm",
4+
"version": "0.1.2-preview",
5+
"parameters": {
6+
"basics": [
7+
{
8+
"name": "adminPassword",
9+
"type": "Microsoft.Common.PasswordBox",
10+
"label": {
11+
"password": "password",
12+
"confirmPassword": "Confirm password"
13+
},
14+
"constraints": {
15+
"required": true,
16+
"regex": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}$",
17+
"validationMessage": "Password must be at least 12 characters long"
18+
},
19+
"options": {
20+
"hideConfirmation": false
21+
}
22+
}
23+
],
24+
"steps": []
25+
}
26+
}

0 commit comments

Comments
 (0)