@@ -21,28 +21,29 @@ Describe -Name 'Public/Connect-Rubrik' -Tag 'Public', 'Connect-Rubrik' -Fixture
21
21
# endregion
22
22
23
23
Context - Name ' Validate Connecting to Cluster' {
24
- Mock - CommandName Get-RubrikAPIVersion - Verifiable - ModuleName ' Rubrik' - MockWith { }
25
- Mock - CommandName Get-RubrikSoftwareVersion - Verifiable - ModuleName ' Rubrik' - MockWith {
26
- ' 5.1.2-8188'
27
- }
28
- Mock - CommandName New-UserAgentString - Verifiable - ModuleName ' Rubrik' - MockWith { }
29
- Mock - CommandName Submit-Request - Verifiable - ModuleName ' Rubrik' - MockWith {
30
- [pscustomobject ]@ {
31
- id = 11111
32
- userId = 22222
33
- token = 33333
34
- }
35
- }
36
- Mock - CommandName Invoke-RestMethod - Verifiable - ModuleName ' Rubrik' - MockWith {
37
- [pscustomobject ]@ {
38
- sessionId = " 22222"
39
- serviceAccountId = " 11111"
40
- token = " 33333"
41
- expirationTime = " 3022-12-10T06:19:52.250Z"
42
- organizationId = " 44444"
24
+
25
+ Mock - CommandName Get-RubrikAPIVersion - Verifiable - ModuleName ' Rubrik' - MockWith { }
26
+ Mock - CommandName Get-RubrikSoftwareVersion - Verifiable - ModuleName ' Rubrik' - MockWith {
27
+ ' 5.1.2-8188'
43
28
}
44
- }
29
+ Mock - CommandName New-UserAgentString - Verifiable - ModuleName ' Rubrik' - MockWith { }
30
+ Mock - CommandName Submit-Request - Verifiable - ModuleName ' Rubrik' - MockWith {
31
+ [pscustomobject ]@ {
32
+ id = 11111
33
+ userId = 22222
34
+ token = 33333
35
+ }
45
36
37
+ Mock - CommandName Invoke-RestMethod - Verifiable - ModuleName ' Rubrik' - MockWith {
38
+ [pscustomobject ]@ {
39
+ sessionId = " 22222"
40
+ serviceAccountId = " 11111"
41
+ token = " 33333"
42
+ expirationTime = " 3022-12-10T06:19:52.250Z"
43
+ organizationId = " 44444"
44
+ }
45
+ }
46
+ }
46
47
It - Name ' Username / Password combination' - Test {
47
48
(Connect-Rubrik - Server testcluster - Username jaapbrasser - Password $ (ConvertTo-SecureString - String password - AsPlainText - Force)) | Out-String |
48
49
Should - BeLikeExactly ' *Basic*'
@@ -59,19 +60,21 @@ Describe -Name 'Public/Connect-Rubrik' -Tag 'Public', 'Connect-Rubrik' -Fixture
59
60
It - Name ' API Token' - Test {
60
61
(Connect-Rubrik - Server testcluster - Token 33333 ) | Out-String |
61
62
Should - BeLikeExactly ' *Token*'
63
+
62
64
}
63
65
64
66
It - Name ' Service Account' - Test {
65
67
(Connect-Rubrik - Server testcluster - Id Username - Secret 33333 ) | Out-String |
66
68
Should - BeLikeExactly ' *ServiceAccount*'
69
+
67
70
}
68
71
69
72
It - Name ' RubrikConnections array should contain 4 entries' - Test {
70
73
@ ($RubrikConnections ).Count |
71
74
Should - Be 4
75
+
72
76
}
73
-
74
- Assert-VerifiableMock
75
77
Assert-MockCalled - CommandName Submit-Request - ModuleName ' Rubrik' - Exactly 3
78
+
76
79
}
77
80
}
0 commit comments