-
Couldn't load subscription status.
- Fork 36
Integration testing 2604 #735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 5 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
44eae79
Added test cases for Application
v-akarke 33d224e
Integration-Testing
v-akarke f61f184
added Add-EntraGroupMember
v-akarke 2e452c8
Added integration script
snehalkotwal 77b1f2b
updates script
snehalkotwal 6cf3e9a
Remove set-domain file
snehalkotwal 81be5a8
Integration test added
snehalkotwal c7fe3f6
Merge branch 'main' of https://github.com/microsoftgraph/entra-powers…
snehalkotwal 68076a0
Integration script added
snehalkotwal 0ea3e3f
Integration script added
snehalkotwal 4179caf
Integration tests
snehalkotwal 7b80a68
Integration tests
snehalkotwal 37fc06a
Integration tests
snehalkotwal e213840
Merge branch 'main' of https://github.com/microsoftgraph/entra-powers…
snehalkotwal b92d76a
Integration tests
snehalkotwal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
test/module/Entra/Integration/Add-EntraGroupMember.Tests.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| Describe "The Add-EntraGroupMember command executing unmocked" { | ||
|
|
||
| Context "When getting user and group" { | ||
| BeforeAll { | ||
| $testReportPath = join-path $psscriptroot "\setenv.ps1" | ||
| Import-Module -Name $testReportPath | ||
| $appId = $env:TEST_APPID | ||
| $tenantId = $env:TEST_TENANTID | ||
| $cert = $env:CERTIFICATETHUMBPRINT | ||
| Connect-Entra -TenantId $tenantId -AppId $appId -CertificateThumbprint $cert | ||
|
|
||
| $thisTestInstanceId = New-Guid | select -expandproperty guid | ||
| $testName = 'SimpleTest' + $thisTestInstanceId | ||
|
|
||
| #create test user | ||
| $PasswordProfile = New-Object -TypeName Microsoft.Open.AzureAD.Model.PasswordProfile | ||
| $PasswordProfile.Password = "Pass@1234" | ||
| $global:newUser = New-EntraUser -AccountEnabled $true -DisplayName $testName -PasswordProfile $PasswordProfile -MailNickName $testName -UserPrincipalName "[email protected]" | ||
|
|
||
| #create test group | ||
| $global:newGroup = New-EntraGroup -DisplayName $testName -MailEnabled $false -SecurityEnabled $true -MailNickName $testName | ||
| } | ||
|
|
||
| It "should successfully add user to new created group" { | ||
| $user = Get-EntraUser -ObjectId $newUser.Id | ||
| $user.Id | Should -Be $newUser.Id | ||
| $user.DisplayName | Should -Be $testName | ||
|
|
||
| $group = Get-EntraGroup -ObjectId $newGroup.Id | ||
| $group.Id | Should -Be $newGroup.Id | ||
| $group.DisplayName | Should -Be $testName | ||
|
|
||
| Add-EntraGroupMember -ObjectId $group.Id -RefObjectId $user.Id | ||
| $result = Get-EntraGroupMember -ObjectId $group.Id | ||
| $result.Id | Should -Contain $user.Id | ||
| } | ||
|
|
||
| AfterAll { | ||
| Remove-EntraGroupMember -ObjectId $newGroup.Id -MemberId $newUser.Id | ||
| Remove-EntraUser -ObjectId $newUser.Id | ||
| Remove-EntraGroup -ObjectId $newGroup.Id | ||
| } | ||
| } | ||
| } |
36 changes: 36 additions & 0 deletions
36
test/module/Entra/Integration/Get-EntraApplication.Tests.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| Describe "The Get-EntraApplication command executing unmocked" { | ||
|
|
||
| Context "When getting applications" { | ||
| BeforeAll { | ||
| $testReportPath = join-path $psscriptroot "\setenv.ps1" | ||
| Import-Module -Name $testReportPath | ||
| $appId = $env:TEST_APPID | ||
| $tenantId = $env:TEST_TENANTID | ||
| $cert = $env:CERTIFICATETHUMBPRINT | ||
| Connect-Entra -TenantId $tenantId -AppId $appId -CertificateThumbprint $cert | ||
|
|
||
| $thisTestInstanceId = New-Guid | select -expandproperty guid | ||
| $testAppName = 'SimpleTestAppRead' + $thisTestInstanceId | ||
| $testApp = New-EntraApplication -DisplayName $testAppName | ||
| } | ||
|
|
||
| It "should successfully read the application with expected properties when the application ID parameter is used" { | ||
| $app = Get-EntraApplication -ObjectId $testApp.Id | ||
| $app.Id | Should -Be $testApp.Id | ||
| $app.DisplayName | Should -Be $testAppName | ||
| } | ||
|
|
||
| It "should throw an exception if a nonexistent object ID parameter is specified" { | ||
| $Id = (New-Guid).Guid | ||
| Get-EntraApplication -ObjectId $Id -ErrorAction Stop | ||
| $Error[0] | Should -match "Resource '([^']+)' does not exist" | ||
| } | ||
|
|
||
| AfterAll { | ||
| foreach ($app in (Get-EntraApplication -All $true | Where-Object { $_.DisplayName -eq $testAppName})) { | ||
| Remove-EntraApplication -ObjectId $app.Id | Out-Null | ||
| } | ||
|
|
||
| } | ||
| } | ||
| } |
28 changes: 28 additions & 0 deletions
28
test/module/Entra/Integration/New-EntraApplication.Tests.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| Describe "The Get-EntraApplication command executing unmocked" { | ||
|
|
||
| Context "When creating applications" { | ||
| BeforeAll { | ||
| $testReportPath = join-path $psscriptroot "\setenv.ps1" | ||
| Import-Module -Name $testReportPath | ||
| $appId = $env:TEST_APPID | ||
| $tenantId = $env:TEST_TENANTID | ||
| $cert = $env:CERTIFICATETHUMBPRINT | ||
| Connect-Entra -TenantId $tenantId -AppId $appId -CertificateThumbprint $cert | ||
|
|
||
| $thisTestInstanceId = New-Guid | select -expandproperty guid | ||
| } | ||
|
|
||
| It "should succeed when creating a new application" { | ||
| $testAppName = 'SimpleTestApp' + $thisTestInstanceId | ||
| $newApp = New-EntraApplication -DisplayName $testAppName | ||
| $newApp.DisplayName | Should -Be $testAppName | ||
| { Get-EntraApplication -ObjectId $newApp.Id } | Should -Not -BeNullOrEmpty | ||
| } | ||
|
|
||
| AfterAll { | ||
| foreach ($app in (Get-EntraApplication -All $true | Where-Object { $_.DisplayName -eq $testAppName})) { | ||
| Remove-EntraApplication -ObjectId $app.Id | Out-Null | ||
| } | ||
| } | ||
| } | ||
| } |
34 changes: 34 additions & 0 deletions
34
test/module/Entra/Integration/Set-EntraApplication.Tests.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| Describe "The Get-EntraApplication command executing unmocked" { | ||
|
|
||
| Context "When getting applications" { | ||
| BeforeAll { | ||
| $testReportPath = join-path $psscriptroot "\setenv.ps1" | ||
| Import-Module -Name $testReportPath | ||
| $appId = $env:TEST_APPID | ||
| $tenantId = $env:TEST_TENANTID | ||
| $cert = $env:CERTIFICATETHUMBPRINT | ||
| Connect-Entra -TenantId $tenantId -AppId $appId -CertificateThumbprint $cert | ||
|
|
||
| $thisTestInstanceId = New-Guid | select -expandproperty guid | ||
| $testAppName = 'SimpleTestAppRead' + $thisTestInstanceId | ||
| $testApp = New-EntraApplication -DisplayName $testAppName | ||
| } | ||
|
|
||
| It "should successfully update the application with expected properties when the application ID parameter is used" { | ||
| $thisTestInstanceId = New-Guid | select -expandproperty guid | ||
| $newAppName = 'SimpleTestAppUpdate' + $thisTestInstanceId | ||
| Set-EntraApplication -ObjectId $testApp.Id -DisplayName $newAppName | Should -BeNullOrEmpty | ||
|
|
||
| $app = Get-EntraApplication -ObjectId $testApp.Id | ||
| $app.Id | Should -Be $testApp.Id | ||
| $app.DisplayName | Should -Be $newAppName | ||
| } | ||
|
|
||
| AfterAll { | ||
| foreach ($app in (Get-EntraApplication -All $true | Where-Object { $_.DisplayName -eq $newAppName})) { | ||
| Remove-EntraApplication -ObjectId $app.Id | Out-Null | ||
| } | ||
|
|
||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| Describe "The Get-EntraDomain command executing unmocked" { | ||
|
|
||
| Context "When getting domains" { | ||
| BeforeAll { | ||
| $testReportPath = join-path $psscriptroot "\setenv.ps1" | ||
| Import-Module -Name $testReportPath | ||
| $appId = $env:TEST_APPID | ||
| $tenantId = $env:TEST_TENANTID | ||
| $cert = $env:CERTIFICATETHUMBPRINT | ||
| Connect-Entra -TenantId $tenantId -AppId $appId -CertificateThumbprint $cert | ||
|
|
||
| # $thisTestInstanceId = New-Guid | select -expandproperty guid | ||
| # $testDomainName = 'sampledomain.com' | ||
| $global:testDomainName = 'M365x99297270.mail.onmicrosoft.com' | ||
| # $global:testDomain = New-EntraDomain -Name $testDomainName -SupportedServices @("Email", "OfficeCommunicationsOnline") | ||
| } | ||
|
|
||
| It "should successfully update the application with expected properties when the domain Name parameter is used" { | ||
|
|
||
| # Set-EntraDomain -Name $testDomain.Name | Should -BeNullOrEmpty | ||
| # Confirm-EntraDomain -Name $testDomainName | Should -BeNullOrEmpty | ||
| Set-EntraDomain -Name $testDomainName | Should -BeNullOrEmpty | ||
| # Confirm-EntraDomain -Name $testDomainName | Should -BeNullOrEmpty | ||
|
|
||
| # $app = Get-EntraDomain -Name $testDomain.Name | ||
| $app = Get-EntraDomain -Name $testDomainName | ||
| $app.ObjectId | Should -Be $testDomainName | ||
| } | ||
|
|
||
| # AfterAll { | ||
| # Remove-EntraDomain -Name $testDomain.Name | Out-Null | ||
| # } | ||
|
|
||
|
|
||
| } | ||
| } | ||
46 changes: 46 additions & 0 deletions
46
test/module/Entra/Integration/Set-EntraMSRoleDefinition.Tests.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| Describe "The Set-EntraMSRoleDefination command executing unmocked" { | ||
|
|
||
| Context "When getting MSRoleDefination" { | ||
| BeforeAll { | ||
| $testReportPath = join-path $psscriptroot "\setenv.ps1" | ||
| Import-Module -Name $testReportPath | ||
| $appId = $env:TEST_APPID | ||
| $tenantId = $env:TEST_TENANTID | ||
| $cert = $env:CERTIFICATETHUMBPRINT | ||
| Connect-Entra -TenantId $tenantId -AppId $appId -CertificateThumbprint $cert | ||
|
|
||
| $thisTestInstanceId = New-Guid | select -expandproperty guid | ||
| $testName = 'SimpleRoleDefination' + $thisTestInstanceId | ||
|
|
||
| #create new role defination | ||
| $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission | ||
| $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") | ||
| $global:newmsRoleDefinition = New-EntraMSRoleDefinition -RolePermissions $RolePermissions -IsEnabled $false -DisplayName $testName | ||
|
|
||
| } | ||
|
|
||
| It "should successfully update the msrole defination with expected properties when the msrole defination ID parameter is used" { | ||
| $thisTestInstanceId = New-Guid | select -expandproperty guid | ||
| $newmsrolename = 'SimpleRoleDefinationUpdated' + $thisTestInstanceId | ||
| Set-EntraMSRoleDefinition -Id $newmsRoleDefinition.Id -DisplayName $newmsrolename | Should -BeNullOrEmpty | ||
|
|
||
| $app = Get-EntraMSRoleDefinition -Id $newmsRoleDefinition.Id | ||
| $app | Should -Not -BeNullOrEmpty | ||
| $app.Id | Should -Be $newmsRoleDefinition.Id | ||
| $app.DisplayName | Should -Be $newmsrolename | ||
| } | ||
| It "should throw an exception if a nonexistent object ID parameter is specified" { | ||
| $Id = (New-Guid).Guid | ||
| Get-EntraMSRoleDefinition -Id $Id -ErrorAction Stop | ||
| $Error[0] | Should -match "Resource '([^']+)' does not exist" | ||
| } | ||
|
|
||
| AfterAll { | ||
| Remove-EntraMSRoleDefinition -Id $newmsRoleDefinition.Id | Out-Null | ||
| } | ||
|
|
||
| } | ||
|
|
||
|
|
||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| $env:TEST_APPID = "8886ad7b-1795-4542-9808-c85859d97f23" | ||
| $env:TEST_TENANTID = "d5aec55f-2d12-4442-8d2f-ccca95d4390e" | ||
| $env:CERTIFICATETHUMBPRINT = "70FE8FCE6AD12B194D34951863872D103B0434A9" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.