diff --git a/autorest.powershell b/autorest.powershell index 0c2156a8509..747638f7dbb 160000 --- a/autorest.powershell +++ b/autorest.powershell @@ -1 +1 @@ -Subproject commit 0c2156a8509e50b49a64d83a403abaf111392755 +Subproject commit 747638f7dbb12bcaa76b4790c7072dfb2bff5af7 diff --git a/src/Users/v1.0/test/Langchain.jpg b/src/Users/v1.0/test/Langchain.jpg new file mode 100644 index 00000000000..d0c48fcb4ba Binary files /dev/null and b/src/Users/v1.0/test/Langchain.jpg differ diff --git a/src/Users/v1.0/test/Set-MgUserPhotoContent.Recording.json b/src/Users/v1.0/test/Set-MgUserPhotoContent.Recording.json new file mode 100644 index 00000000000..8ec201d3019 --- /dev/null +++ b/src/Users/v1.0/test/Set-MgUserPhotoContent.Recording.json @@ -0,0 +1,31 @@ +{ + "Set-MgUserPhotoContent+[NoContext]+ShouldUpdatePhoto+$PUT+https://graph.microsoft.com/v1.0/users/contoso@micorosoft.com/photo/$value": { + "Request": { + "Method": "PUT", + "Body": "binary data", + "Headers": { + "Content-Type": "image/jpg" + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Strict-Transport-Security": [ + "max-age=31536000" + ], + "request-id": [ + "ceec1bb3-bfe4-4f4c-9bba-b47f18ab1372" + ], + "client-request-id": [ + "7f583ee0-9357-4c32-84df-25f1d7f05636" + ], + "x-ms-ags-diagnostic": [ + "{\"ServerInfo\":{\"DataCenter\":\"West US 2\",\"Slice\":\"E\",\"Ring\":\"1\",\"ScaleUnit\":\"001\",\"RoleInstance\":\"MW2PEPF0000749D\"}}" + ], + "Date": [ + "Thu, 04 Jun 2024 16:33:12 GMT" + ] + } + } + } +} \ No newline at end of file diff --git a/src/Users/v1.0/test/Set-MgUserPhotoContent.Tests.ps1 b/src/Users/v1.0/test/Set-MgUserPhotoContent.Tests.ps1 new file mode 100644 index 00000000000..db491c3af58 --- /dev/null +++ b/src/Users/v1.0/test/Set-MgUserPhotoContent.Tests.ps1 @@ -0,0 +1,27 @@ +if (($null -eq $TestName) -or ($TestName -contains 'Set-MgUserPhotoContent')) { + $TestMode = 'playback' + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Set-MgUserPhotoContent.Recording.json' + $currentPath = $PSScriptRoot + while (-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Set-MgUserPhotoContent' { + BeforeAll { + $Mock.PushDescription('Set-MgUserPhotoContent') + } + Context 'Update' { + It 'ShouldUpdatePhoto' { + $Mock.PushScenario('ShouldUpdatePhoto') + { Set-MgUserPhotoContent -UserId contoso@microsoft.com -InFile "src\Users\v1.0\test\Langchain.jpg" } | Should -Not -Throw + } + } +}