@@ -21,7 +21,8 @@ function Test-RoleDefinitionCreateTests
21
21
# Setup
22
22
# Basic positive case - read from file
23
23
$rdName = ' CustomRole Tests Role'
24
- New-AzureRmRoleDefinitionWithId - InputFile " $TestOutputRoot \Resources\NewRoleDefinition.json" - RoleDefinitionId ee78fa8a- 3cdd- 418e - a4d8- 949b57a33dcd
24
+ $inputFilePath = Join-Path - Path $TestOutputRoot - ChildPath Resources\NewRoleDefinition.json
25
+ New-AzureRmRoleDefinitionWithId - InputFile $inputFilePath - RoleDefinitionId ee78fa8a- 3cdd- 418e - a4d8- 949b57a33dcd
25
26
26
27
$rd = Get-AzureRmRoleDefinition - Name $rdName
27
28
Assert-AreEqual " Test role" $rd.Description
@@ -70,7 +71,8 @@ function Test-RdNegativeScenarios
70
71
$badIdException = " Cannot find role definition with id '" + $rdId + " '."
71
72
72
73
# Throws on trying to update the a role that does not exist
73
- Assert-Throws { Set-AzureRmRoleDefinition - InputFile " $TestOutputRoot \Resources\RoleDefinition.json" } $badIdException
74
+ $inputFilePath = Join-Path - Path $TestOutputRoot - ChildPath Resources\RoleDefinition.json
75
+ Assert-Throws { Set-AzureRmRoleDefinition - InputFile $inputFilePath } $badIdException
74
76
75
77
# Role Defintion not provided.
76
78
$roleDefNotProvided = " Parameter set cannot be resolved using the specified named parameters."
@@ -84,7 +86,7 @@ function Test-RdNegativeScenarios
84
86
# Role not provided.
85
87
$roleDefNotProvided = " Cannot validate argument on parameter 'Role'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again."
86
88
Assert-Throws { Set-AzureRmRoleDefinition - Role $rdNull } $roleDefNotProvided
87
- Assert-Throws { Set-AzureRmRoleDefinition - InputFile " $TestOutputRoot \Resources\RoleDefinition.json " - Role $rd } $roleDefNotProvided
89
+ Assert-Throws { Set-AzureRmRoleDefinition - InputFile $inputFilePath - Role $rd } $roleDefNotProvided
88
90
89
91
# TODO add check for valid input file and valid role
90
92
@@ -103,7 +105,8 @@ function Test-RDPositiveScenarios
103
105
# Setup
104
106
# Create a role definition with Name rdNamme.
105
107
$rdName = ' Another tests role'
106
- $rd = New-AzureRmRoleDefinitionWithId - InputFile " $TestOutputRoot \Resources\RoleDefinition.json" - RoleDefinitionId 0a0e83bc- 50b9- 4c4d- b2c2- 3f41e1a8baf2
108
+ $inputFilePath = Join-Path - Path $TestOutputRoot - ChildPath Resources\RoleDefinition.json
109
+ $rd = New-AzureRmRoleDefinitionWithId - InputFile $inputFilePath - RoleDefinitionId 0a0e83bc- 50b9- 4c4d- b2c2- 3f41e1a8baf2
107
110
$rd = Get-AzureRmRoleDefinition - Name $rdName
108
111
109
112
# Update the role definition with action that was created in the step above.
@@ -129,7 +132,8 @@ function Test-RDUpdate
129
132
130
133
# Create a role definition with Name rdNamme.
131
134
$rdName = ' Another tests role'
132
- $rd = New-AzureRmRoleDefinitionWithId - InputFile " $TestOutputRoot \Resources\RoleDefinition.json" - RoleDefinitionId 3d95b97a- 5745 - 4c39- 950c- 0b608dea635f
135
+ $inputFilePath = Join-Path - Path $TestOutputRoot - ChildPath Resources\RoleDefinition.json
136
+ $rd = New-AzureRmRoleDefinitionWithId - InputFile $inputFilePath - RoleDefinitionId 3d95b97a- 5745 - 4c39- 950c- 0b608dea635f
133
137
$rd = Get-AzureRmRoleDefinition - Name $rdName
134
138
135
139
# Update the role definition with action that was created in the step above.
@@ -158,7 +162,8 @@ function Test-RDCreateFromFile
158
162
$badScopeException = " Exception calling `" ExecuteCmdlet`" with `" 0`" argument(s): `" Scope '/subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/ResourceGroups' should have even number of parts.`" "
159
163
try
160
164
{
161
- $rd = New-AzureRmRoleDefinitionWithId - InputFile " $TestOutputRoot \Resources\InvalidRoleDefinition.json" - RoleDefinitionId 4482e4d1- 8757 - 4d67- b3c1- 5c8ccee3fdcc
165
+ $inputFilePath = Join-Path - Path $TestOutputRoot - ChildPath Resources\InvalidRoleDefinition.json
166
+ $rd = New-AzureRmRoleDefinitionWithId - InputFile $inputFilePath - RoleDefinitionId 4482e4d1- 8757 - 4d67- b3c1- 5c8ccee3fdcc
162
167
Assert-AreEqual " This assertion shouldn't be hit'" " New-AzureRmRoleDefinition should've thrown an exception"
163
168
}
164
169
catch
@@ -280,7 +285,8 @@ function Test-RoleDefinitionDataActionsCreateTests
280
285
# Setup
281
286
# Basic positive case - read from file
282
287
$rdName = ' CustomRole Tests Role New'
283
- New-AzureRmRoleDefinitionWithId - InputFile " $TestOutputRoot \Resources\DataActionsRoleDefinition.json" - RoleDefinitionId e3efe8c9- d9ae- 4f0e- 838d - 57ce43068a13
288
+ $inputFilePath = Join-Path - Path $TestOutputRoot - ChildPath Resources\DataActionsRoleDefinition.json
289
+ New-AzureRmRoleDefinitionWithId - InputFile $inputFilePath - RoleDefinitionId e3efe8c9- d9ae- 4f0e- 838d - 57ce43068a13
284
290
285
291
$rd = Get-AzureRmRoleDefinition - Name $rdName
286
292
Assert-AreEqual " Test role" $rd.Description
@@ -322,7 +328,8 @@ function Test-RDGetCustomRoles
322
328
# Setup
323
329
# Basic positive case - read from file
324
330
$rdName = ' Another tests role'
325
- $rd = New-AzureRmRoleDefinitionWithId - InputFile " $TestOutputRoot \Resources\RoleDefinition.json" - RoleDefinitionId 3d95b97a- 5745 - 4c39- 950c- 0b608dea635f
331
+ $inputFilePath = Join-Path - Path $TestOutputRoot - ChildPath Resources\RoleDefinition.json
332
+ $rd = New-AzureRmRoleDefinitionWithId - InputFile $inputFilePath - RoleDefinitionId 3d95b97a- 5745 - 4c39- 950c- 0b608dea635f
326
333
$rd = Get-AzureRmRoleDefinition - Name $rdName
327
334
328
335
$roles = Get-AzureRmRoleDefinition - Custom
@@ -437,7 +444,8 @@ function Test-RDDataActionsNegativeTestCases
437
444
# Setup
438
445
# Basic positive case - read from file
439
446
$rdName = ' Another tests role'
440
- $rd = New-AzureRmRoleDefinitionWithId - InputFile " $TestOutputRoot \Resources\RoleDefinition.json" - RoleDefinitionId 3d95b97a- 5745 - 4c39- 950c- 0b608dea635f
447
+ $inputFilePath = Join-Path - Path $TestOutputRoot - ChildPath Resources\RoleDefinition.json
448
+ $rd = New-AzureRmRoleDefinitionWithId - InputFile $inputFilePath - RoleDefinitionId 3d95b97a- 5745 - 4c39- 950c- 0b608dea635f
441
449
$rd = Get-AzureRmRoleDefinition - Name $rdName
442
450
443
451
$createdRole = Get-AzureRmRoleDefinition - Name $rdName
0 commit comments