From 031f92570b0ee8fcc63aa560d1ce01b66a39b187 Mon Sep 17 00:00:00 2001 From: Peter Ombwa Date: Wed, 29 Jun 2022 13:10:52 -0700 Subject: [PATCH 1/3] Lock meta-module GUID. --- config/ModuleMetadata.json | 1 + src/Graph/Graph/Microsoft.Graph.nuspec | 46 +++++++++++++++++++++++--- src/Graph/Graph/Microsoft.Graph.psd1 | 46 +++++++++++++++++++++++--- tools/GenerateRollUpModule.ps1 | 5 ++- 4 files changed, 89 insertions(+), 9 deletions(-) diff --git a/config/ModuleMetadata.json b/config/ModuleMetadata.json index ae7f6893025..52d7cd527ec 100644 --- a/config/ModuleMetadata.json +++ b/config/ModuleMetadata.json @@ -1,4 +1,5 @@ { + "guid": "fceec1eb-c2e8-4b2b-a120-0fab3f0d7b47", "authors": "Microsoft", "owners": "Microsoft", "description": "Microsoft Graph PowerShell module", diff --git a/src/Graph/Graph/Microsoft.Graph.nuspec b/src/Graph/Graph/Microsoft.Graph.nuspec index a335fb83584..678df607bb0 100644 --- a/src/Graph/Graph/Microsoft.Graph.nuspec +++ b/src/Graph/Graph/Microsoft.Graph.nuspec @@ -2,18 +2,56 @@ Microsoft.Graph - 0.9.2 + 1.10.0 Microsoft Microsoft https://aka.ms/devservicesagreement https://github.com/microsoftgraph/msgraph-sdk-powershell - https://raw.githubusercontent.com/microsoftgraph/g-raph/master/g-raph.png + https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-powershell/master/documentation/images/graph_color256.png true Microsoft Graph PowerShell module © Microsoft Corporation. All rights reserved. - MicrosoftGraph;Microsoft;Office365;Graph;PowerShell;GraphServiceClient;Outlook;OneDrive;AzureAD;GraphAPI;Productivity;SharePoint;Intune;SDK; + MicrosoftGraph Microsoft Office365 Graph PowerShell Outlook OneDrive AzureAD SharePoint Intune AzureAutomationNotSupported - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + See https://aka.ms/GraphPowerShell-Release. diff --git a/src/Graph/Graph/Microsoft.Graph.psd1 b/src/Graph/Graph/Microsoft.Graph.psd1 index 4867ff5f5c5..a7196e44cb5 100644 --- a/src/Graph/Graph/Microsoft.Graph.psd1 +++ b/src/Graph/Graph/Microsoft.Graph.psd1 @@ -3,7 +3,7 @@ # # Generated by: Microsoft # -# Generated on: 11/18/2020 +# Generated on: 6/29/2022 # @{ @@ -12,13 +12,13 @@ # RootModule = '' # Version number of this module. -ModuleVersion = '1.1.0' +ModuleVersion = '1.10.0' # Supported PSEditions CompatiblePSEditions = 'Core', 'Desktop' # ID used to uniquely identify this module -GUID = 'ba3e9757-d74f-45ea-9d0f-0287d0d45b9a' +GUID = 'fceec1eb-c2e8-4b2b-a120-0fab3f0d7b47' # Author of this module Author = 'Microsoft' @@ -51,7 +51,45 @@ DotNetFrameworkVersion = '4.7.2' # ProcessorArchitecture = '' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @(@{ModuleName = 'Microsoft.Graph.Authentication'; ModuleVersion = '0.9.1'; }) +RequiredModules = @(@{ModuleName = 'Microsoft.Graph.Authentication'; ModuleVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Calendar'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.DeviceManagement.Functions'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Identity.Governance'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.ChangeNotifications'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Users.Actions'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.SchemaExtensions'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.DeviceManagement.Enrolment'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Bookings'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Devices.CorporateManagement'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Devices.ServiceAnnouncement'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Users.Functions'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Education'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Notes'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.DirectoryObjects'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Applications'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.People'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Groups'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.CrossDeviceExperiences'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Reports'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Users'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Search'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Teams'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Identity.SignIns'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Files'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.WindowsUpdates'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Compliance'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.DeviceManagement'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.DeviceManagement.Actions'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Planner'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Identity.DirectoryManagement'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.PersonalContacts'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Financials'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.DeviceManagement.Administration'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Mail'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Sites'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Security'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.CloudCommunications'; RequiredVersion = '1.10.0'; }, + @{ModuleName = 'Microsoft.Graph.Devices.CloudPrint'; RequiredVersion = '1.10.0'; }) # Assemblies that must be loaded prior to importing this module # RequiredAssemblies = @() diff --git a/tools/GenerateRollUpModule.ps1 b/tools/GenerateRollUpModule.ps1 index abdb2950a5a..9c89d8118b8 100644 --- a/tools/GenerateRollUpModule.ps1 +++ b/tools/GenerateRollUpModule.ps1 @@ -89,7 +89,8 @@ elseif ($VersionState.Equals([VersionState]::Valid) -or $VersionState.Equals([Ve } foreach ($RequiredModule in $ModuleMapping.Keys) { - # Install module locally in order to specify it as a dependency of the roll-up module down the generation pipeline. + # Install module locally in order to specify it as a dependency of the roll-up module down. + # New-ModuleManifest expects all required modules to be installed locally. # https://stackoverflow.com/questions/46216038/how-do-i-define-requiredmodules-in-a-powershell-module-manifest-psd1. $ExistingWorkloadModule = Find-Module "$ModulePrefix.$RequiredModule" -Repository $RepositoryName -AllowPrerelease:$AllowPreRelease -ErrorAction SilentlyContinue if ($null -ne $ExistingWorkloadModule) { @@ -128,6 +129,7 @@ elseif ($VersionState.Equals([VersionState]::Valid) -or $VersionState.Equals([Ve AliasesToExport = @() CmdletsToExport = @() FunctionsToExport = @() + GUID = $NuspecMetadata["guid"] } Write-Host -ForegroundColor Green "Creating '$ModulePrefix' module manifest and nuspec..." @@ -145,6 +147,7 @@ elseif ($VersionState.Equals([VersionState]::Valid) -or $VersionState.Equals([Ve Copy-Item (Join-Path $PSScriptRoot "\Templates\$ModulePrefix.nuspec") -Destination $GraphModuleLocation } + $NuspecMetadata.Remove("guid") Set-NuSpecValuesFromManifest -NuSpecFilePath "$RollUpModuleNuspec.nuspec" -Manifest $NuspecMetadata if ($Pack) { From 95cd018620afcf03b3713c8268bc74f4196b3adf Mon Sep 17 00:00:00 2001 From: Peter Ombwa Date: Wed, 29 Jun 2022 13:54:22 -0700 Subject: [PATCH 2/3] Lock GUID of service modules. --- tools/GenerateModules.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/GenerateModules.ps1 b/tools/GenerateModules.ps1 index 5d16c970ac4..e554bf92126 100644 --- a/tools/GenerateModules.ps1 +++ b/tools/GenerateModules.ps1 @@ -195,10 +195,11 @@ $ModulesToGenerate | ForEach-Object -ThrottleLimit $NumberOfCores -Parallel { $ModuleExportsPath = Join-Path $ModuleProjectDir "\exports" $Profiles = Get-ChildItem -Path $ModuleExportsPath -Directory | % { $_.Name } - # Update module manifest wiht profiles. - $ModuleManifestPath = Join-Path $ModuleProjectDir "$FullyQualifiedModuleName.psd1" + # Update module manifest. + $ExistingServiceModule = Find-Module $FullyQualifiedModuleName -Repository PSGallery -ErrorAction SilentlyContinue + $ModuleGuid = ($null -eq $ExistingServiceModule) ? (New-Guid).Guid : $ExistingServiceModule.AdditionalMetadata.GUID [HashTable]$PrivateData = @{ Profiles = $Profiles } - Update-ModuleManifest -Path $ModuleManifestPath -PrivateData $PrivateData + Update-ModuleManifest -Path (Join-Path $ModuleProjectDir "$FullyQualifiedModuleName.psd1") -PrivateData $PrivateData -Guid $ModuleGuid # Update module psm1 with Graph session profile name. $ModulePsm1 = Join-Path $ModuleProjectDir "/$FullyQualifiedModuleName.psm1" From 533c6883529a2a7c9f71116d67944ed331d94cb1 Mon Sep 17 00:00:00 2001 From: Peter Ombwa Date: Wed, 29 Jun 2022 15:28:53 -0700 Subject: [PATCH 3/3] Add basic Pester tests. --- .../Applications/test/Applications.Tests.ps1 | 42 ------------- .../Microsoft.Graph.Applications.Tests.ps1 | 61 +++++++++++++++++++ .../Microsoft.Graph.Authentication.Tests.ps1 | 4 ++ .../Authentication/test/loadEnv.ps1 | 4 +- ...Microsoft.Graph.Identity.SignIns.Tests.ps1 | 28 +++++++++ .../test/Microsoft.Graph.Reports.Tests.ps1 | 28 +++++++++ .../test/Microsoft.Graph.Sites.Tests.ps1 | 28 +++++++++ .../test/Microsoft.Graph.Users.Tests.ps1 | 28 +++++++++ 8 files changed, 180 insertions(+), 43 deletions(-) delete mode 100644 src/Applications/Applications/test/Applications.Tests.ps1 create mode 100644 src/Applications/Applications/test/Microsoft.Graph.Applications.Tests.ps1 create mode 100644 src/Identity.SignIns/Identity.SignIns/test/Microsoft.Graph.Identity.SignIns.Tests.ps1 create mode 100644 src/Reports/Reports/test/Microsoft.Graph.Reports.Tests.ps1 create mode 100644 src/Sites/Sites/test/Microsoft.Graph.Sites.Tests.ps1 create mode 100644 src/Users/Users/test/Microsoft.Graph.Users.Tests.ps1 diff --git a/src/Applications/Applications/test/Applications.Tests.ps1 b/src/Applications/Applications/test/Applications.Tests.ps1 deleted file mode 100644 index 3649a7dbcd0..00000000000 --- a/src/Applications/Applications/test/Applications.Tests.ps1 +++ /dev/null @@ -1,42 +0,0 @@ -BeforeAll { - $ModuleName = "Microsoft.Graph.Applications" - $ModulePath = Join-Path $PSScriptRoot "..\$ModuleName.psd1" -} - -Describe "Applications Module" { - It "Module should be available when imported" { - Import-Module $ModulePath - $LoadedModule = Get-Module -Name $ModuleName - - $LoadedModule | Should -Not -Be $null - $LoadedModule.ExportedCommands.Count | Should -Not -Be 0 - } - - It "Module import should not write to streams when debug preference is not set" { - $ps = [powershell]::Create() - $ps.AddScript("Import-Module $ModulePath -ErrorAction SilentlyContinue").Invoke() - - $ps.Streams.Information.Count | Should -Be 0 - $ps.Streams.Debug.Count | Should -Be 0 - $ps.Streams.Error.Count | Should -Be 0 - $ps.Streams.Verbose.Count | Should -Be 0 - $ps.Streams.Warning.Count | Should -Be 0 - $ps.Streams.Progress.Count | Should -Be 0 - - $ps.Dispose() - } - - It "Module import should write to streams when debug preference is set" { - $ps = [powershell]::Create() - $ps.AddScript("`$DebugPreference = 'Inquire'; Import-Module $ModulePath -ErrorAction SilentlyContinue").Invoke() - - $ps.Streams.Information.Count | Should -Be 0 - $ps.Streams.Debug.Count | Should -Be 0 - $ps.Streams.Error.Count | Should -Be 0 - $ps.Streams.Verbose.Count | Should -Be 0 - $ps.Streams.Warning.Count | Should -Be 0 - $ps.Streams.Progress.Count | Should -Be 0 - - $ps.Dispose() - } -} \ No newline at end of file diff --git a/src/Applications/Applications/test/Microsoft.Graph.Applications.Tests.ps1 b/src/Applications/Applications/test/Microsoft.Graph.Applications.Tests.ps1 new file mode 100644 index 00000000000..7a595ecdee8 --- /dev/null +++ b/src/Applications/Applications/test/Microsoft.Graph.Applications.Tests.ps1 @@ -0,0 +1,61 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ +Describe "Microsoft.Graph.Applications Module" { + BeforeAll { + $ModuleName = "Microsoft.Graph.Applications" + $ModulePath = Join-Path $PSScriptRoot "..\$ModuleName.psd1" + $PSModuleInfo = Get-Module $ModuleName + } + + Context "On module import" { + It "Should have exported commands" { + $PSModuleInfo | Should -Not -Be $null + $PSModuleInfo.ExportedCommands.Count | Should -Not -Be 0 + } + + It 'Should be compatible with PS core and desktop' { + $PSModuleInfo.CompatiblePSEditions | Should -BeIn @("Core", "Desktop") + } + + It 'Should point to script module' { + $PSModuleInfo.Path | Should -BeLikeExactly "*$ModuleName.psm1" + } + + It 'Should have a definition' { + $PSModuleInfo.Definition | Should -Not -BeNullOrEmpty + } + + It 'Should lock GUID' { + $PSModuleInfo.Guid.Guid | Should -Be "467f54f2-44a8-4993-8e75-b96c3e443098" + } + + It "Module import should not write to streams when debug preference is not set" { + $ps = [powershell]::Create() + $ps.AddScript("Import-Module $ModulePath -ErrorAction SilentlyContinue").Invoke() + + $ps.Streams.Information.Count | Should -Be 0 + $ps.Streams.Debug.Count | Should -Be 0 + $ps.Streams.Error.Count | Should -Be 0 + $ps.Streams.Verbose.Count | Should -Be 0 + $ps.Streams.Warning.Count | Should -Be 0 + $ps.Streams.Progress.Count | Should -Be 0 + + $ps.Dispose() + } + + It "Module import should write to streams when debug preference is set" { + $ps = [powershell]::Create() + $ps.AddScript("`$DebugPreference = 'Inquire'; Import-Module $ModulePath -ErrorAction SilentlyContinue").Invoke() + + $ps.Streams.Information.Count | Should -Be 0 + $ps.Streams.Debug.Count | Should -Be 0 + $ps.Streams.Error.Count | Should -Be 0 + $ps.Streams.Verbose.Count | Should -Be 0 + $ps.Streams.Warning.Count | Should -Be 0 + $ps.Streams.Progress.Count | Should -Be 0 + + $ps.Dispose() + } + } +} \ No newline at end of file diff --git a/src/Authentication/Authentication/test/Microsoft.Graph.Authentication.Tests.ps1 b/src/Authentication/Authentication/test/Microsoft.Graph.Authentication.Tests.ps1 index 84000e910fe..b533a76a81c 100644 --- a/src/Authentication/Authentication/test/Microsoft.Graph.Authentication.Tests.ps1 +++ b/src/Authentication/Authentication/test/Microsoft.Graph.Authentication.Tests.ps1 @@ -67,5 +67,9 @@ Describe "Microsoft.Graph.Authentication module" { $PSModuleInfo.ExportedAliases.Keys | Should -BeIn $ExpectedAliases } | Should -Not -Throw } + + It 'Should lock GUID' { + $PSModuleInfo.Guid.Guid | Should -Be "883916f2-9184-46ee-b1f8-b6a2fb784cee" + } } } \ No newline at end of file diff --git a/src/Authentication/Authentication/test/loadEnv.ps1 b/src/Authentication/Authentication/test/loadEnv.ps1 index 3e5126424e8..cb5c25bda29 100644 --- a/src/Authentication/Authentication/test/loadEnv.ps1 +++ b/src/Authentication/Authentication/test/loadEnv.ps1 @@ -23,10 +23,12 @@ if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) { } $env = @{} if (Test-Path -Path $envFilePath) { - # Load dummy auth configuration. + # Load dummy auth configuration. This is used to run Pester tests. $env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json -AsHashTable [Microsoft.Graph.PowerShell.Authentication.GraphSession]::Instance.AuthContext = New-Object Microsoft.Graph.PowerShell.Authentication.AuthContext -Property @{ ClientId = $env.ClientId TenantId = $env.TenantId + AuthType = [Microsoft.Graph.PowerShell.Authentication.AuthenticationType]::UserProvidedAccessToken + AuthProviderType = [Microsoft.Graph.PowerShell.Authentication.AuthProviderType]::UserProvidedToken } } \ No newline at end of file diff --git a/src/Identity.SignIns/Identity.SignIns/test/Microsoft.Graph.Identity.SignIns.Tests.ps1 b/src/Identity.SignIns/Identity.SignIns/test/Microsoft.Graph.Identity.SignIns.Tests.ps1 new file mode 100644 index 00000000000..3fa64b5de69 --- /dev/null +++ b/src/Identity.SignIns/Identity.SignIns/test/Microsoft.Graph.Identity.SignIns.Tests.ps1 @@ -0,0 +1,28 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ + +Describe "Microsoft.Graph.Identity.SignIns module" { + BeforeAll { + $ModuleName = "Microsoft.Graph.Identity.SignIns" + $PSModuleInfo = Get-Module $ModuleName + } + + Context "On module import" { + It 'Should be compatible with PS core and desktop' { + $PSModuleInfo.CompatiblePSEditions | Should -BeIn @("Core", "Desktop") + } + + It 'Should point to script module' { + $PSModuleInfo.Path | Should -BeLikeExactly "*$ModuleName.psm1" + } + + It 'Should have a definition' { + $PSModuleInfo.Definition | Should -Not -BeNullOrEmpty + } + + It 'Should lock GUID' { + $PSModuleInfo.Guid.Guid | Should -Be "60f889fa-f873-43ad-b7d3-b7fc1273a44f" + } + } +} \ No newline at end of file diff --git a/src/Reports/Reports/test/Microsoft.Graph.Reports.Tests.ps1 b/src/Reports/Reports/test/Microsoft.Graph.Reports.Tests.ps1 new file mode 100644 index 00000000000..de73c46e52f --- /dev/null +++ b/src/Reports/Reports/test/Microsoft.Graph.Reports.Tests.ps1 @@ -0,0 +1,28 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ + +Describe "Microsoft.Graph.Reports module" { + BeforeAll { + $ModuleName = "Microsoft.Graph.Reports" + $PSModuleInfo = Get-Module $ModuleName + } + + Context "On module import" { + It 'Should be compatible with PS core and desktop' { + $PSModuleInfo.CompatiblePSEditions | Should -BeIn @("Core", "Desktop") + } + + It 'Should point to script module' { + $PSModuleInfo.Path | Should -BeLikeExactly "*$ModuleName.psm1" + } + + It 'Should have a definition' { + $PSModuleInfo.Definition | Should -Not -BeNullOrEmpty + } + + It 'Should lock GUID' { + $PSModuleInfo.Guid.Guid | Should -Be "0bfc88b7-a8ad-471a-8c86-5f0aa3c84217" + } + } +} \ No newline at end of file diff --git a/src/Sites/Sites/test/Microsoft.Graph.Sites.Tests.ps1 b/src/Sites/Sites/test/Microsoft.Graph.Sites.Tests.ps1 new file mode 100644 index 00000000000..c12e040dce0 --- /dev/null +++ b/src/Sites/Sites/test/Microsoft.Graph.Sites.Tests.ps1 @@ -0,0 +1,28 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ + +Describe "Microsoft.Graph.Sites module" { + BeforeAll { + $ModuleName = "Microsoft.Graph.Sites" + $PSModuleInfo = Get-Module $ModuleName + } + + Context "On module import" { + It 'Should be compatible with PS core and desktop' { + $PSModuleInfo.CompatiblePSEditions | Should -BeIn @("Core", "Desktop") + } + + It 'Should point to script module' { + $PSModuleInfo.Path | Should -BeLikeExactly "*$ModuleName.psm1" + } + + It 'Should have a definition' { + $PSModuleInfo.Definition | Should -Not -BeNullOrEmpty + } + + It 'Should lock GUID' { + $PSModuleInfo.Guid.Guid | Should -Be "7ae8c25b-f1dd-466d-a022-b5489f919c70" + } + } +} \ No newline at end of file diff --git a/src/Users/Users/test/Microsoft.Graph.Users.Tests.ps1 b/src/Users/Users/test/Microsoft.Graph.Users.Tests.ps1 new file mode 100644 index 00000000000..c7f9cbdd16e --- /dev/null +++ b/src/Users/Users/test/Microsoft.Graph.Users.Tests.ps1 @@ -0,0 +1,28 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ + +Describe "Microsoft.Graph.Users module" { + BeforeAll { + $ModuleName = "Microsoft.Graph.Users" + $PSModuleInfo = Get-Module $ModuleName + } + + Context "On module import" { + It 'Should be compatible with PS core and desktop' { + $PSModuleInfo.CompatiblePSEditions | Should -BeIn @("Core", "Desktop") + } + + It 'Should point to script module' { + $PSModuleInfo.Path | Should -BeLikeExactly "*$ModuleName.psm1" + } + + It 'Should have a definition' { + $PSModuleInfo.Definition | Should -Not -BeNullOrEmpty + } + + It 'Should lock GUID' { + $PSModuleInfo.Guid.Guid | Should -Be "71150504-37a3-48c6-82c7-7a00a12168db" + } + } +} \ No newline at end of file