Skip to content

Commit

Permalink
Fixed pester test expected messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Microsoft Graph DevX Tooling authored and FehintolaObafemi committed Dec 20, 2024
1 parent e0cd390 commit a9d5dbe
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ Describe 'Connect-MgGraph In Delegated Mode' {

Describe 'Connect-MgGraph In Environment Variable Mode' {
It 'Should throw exception when supported environment variables are not specified' {
{ Connect-MgGraph -EnvironmentVariable -ErrorAction Stop } | Should -Throw -ExpectedMessage "*EnvironmentCredential authentication unavailable. Environment variables are not fully configured*"
{ Connect-MgGraph -EnvironmentVariable -ErrorAction Stop } | Should -Throw -ExpectedMessage "*ClientSecretCredential authentication failed*"
}
It 'Should attempt to use configured environment variables' {
{
$Env:AZURE_CLIENT_ID = "Not_Valid"
$Env:AZURE_CLIENT_SECRET = "Not_Valid"
$Env:AZURE_TENANT_ID = "common"
Connect-MgGraph -EnvironmentVariable -ErrorAction Stop
} | Should -Throw -ExpectedMessage "*ClientSecretCredential authentication failed: AADSTS700016: Application with identifier 'Not_Valid' was not found in the directory 'Microsoft'.*"
} | Should -Throw -ExpectedMessage "*ClientSecretCredential authentication failed*"
}
}

Expand All @@ -99,7 +99,7 @@ Describe 'Connect-MgGraph In App Mode' {
Describe 'Connect-MgGraph Dependency Resolution' {
It 'Should load Mg module side by side with Az module.' {
{ Connect-AzAccount -ApplicationId $RandomClientId -CertificateThumbprint "Invalid" -Tenant "Invalid" -ErrorAction Stop } | Should -Throw -ExpectedMessage "*Could not find tenant id*"
{ Connect-MgGraph -TenantId "thisdomaindoesnotexist.com" -ErrorAction Stop -UseDeviceAuthentication } | Should -Throw -ExpectedMessage "*AADSTS90002*"
{ Connect-MgGraph -TenantId "thisdomaindoesnotexist.com" -ErrorAction Stop -UseDeviceAuthentication } | Should -Throw -ExpectedMessage "*DeviceCodeCredential authentication failed*"
}
}

Expand Down

0 comments on commit a9d5dbe

Please sign in to comment.