From 7de22c3232fb8fadaa23269ff5a4078d787ad54a Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Thu, 26 Dec 2024 16:56:42 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20[Refactor]:=20Rename=20Update-Gi?= =?UTF-8?q?tHubUser=20function=20to=20Set-GitHubUser=20and=20update=20refe?= =?UTF-8?q?rences?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...date-GitHubUser.ps1 => Set-GitHubUser.ps1} | 8 +-- tests/GitHub.Tests.ps1 | 60 +++++++++---------- tools/utilities/Local-Testing.ps1 | 8 +-- 3 files changed, 38 insertions(+), 38 deletions(-) rename src/functions/public/Users/{Update-GitHubUser.ps1 => Set-GitHubUser.ps1} (94%) diff --git a/src/functions/public/Users/Update-GitHubUser.ps1 b/src/functions/public/Users/Set-GitHubUser.ps1 similarity index 94% rename from src/functions/public/Users/Update-GitHubUser.ps1 rename to src/functions/public/Users/Set-GitHubUser.ps1 index 6d8a4ed33..020f9aacc 100644 --- a/src/functions/public/Users/Update-GitHubUser.ps1 +++ b/src/functions/public/Users/Set-GitHubUser.ps1 @@ -1,4 +1,4 @@ -filter Update-GitHubUser { +filter Set-GitHubUser { <# .SYNOPSIS Update the authenticated user @@ -9,17 +9,17 @@ displayed on your public profile or via the API. .EXAMPLE - Update-GitHubUser -Name 'octocat' + Set-GitHubUser -Name 'octocat' Update the authenticated user's name to 'octocat' .EXAMPLE - Update-GitHubUser -Location 'San Francisco' + Set-GitHubUser -Location 'San Francisco' Update the authenticated user's location to 'San Francisco' .EXAMPLE - Update-GitHubUser -Hireable $true -Bio 'I love programming' + Set-GitHubUser -Hireable $true -Bio 'I love programming' Update the authenticated user's hiring availability to 'true' and their biography to 'I love programming' diff --git a/tests/GitHub.Tests.ps1 b/tests/GitHub.Tests.ps1 index c31c284c2..46234b84d 100644 --- a/tests/GitHub.Tests.ps1 +++ b/tests/GitHub.Tests.ps1 @@ -361,7 +361,7 @@ Describe 'As a user - Fine-grained PAT token - user account access (USER_FG_PAT) It 'Get-GitHubUser - Get the specified user (USER_FG_PAT)' { { Get-GitHubUser -Username 'Octocat' } | Should -Not -Throw } - It 'Update-GitHubUser - Can set configuration on a user (USER_FG_PAT)' { + It 'Set-GitHubUser - Can set configuration on a user (USER_FG_PAT)' { # $params = @{ # Name = 'Octocat' # Blog = 'https://marius-storhaug.com' @@ -370,14 +370,14 @@ Describe 'As a user - Fine-grained PAT token - user account access (USER_FG_PAT) # Location = 'USA' # Bio = 'I love programming' # } - # { Update-GitHubUser @params } | Should -Not -Throw + # { Set-GitHubUser @params } | Should -Not -Throw $user = Get-GitHubUser - { Update-GitHubUser -Name 'Octocat' } | Should -Not -Throw - { Update-GitHubUser -Blog 'https://marius-storhaug.com' } | Should -Not -Throw - { Update-GitHubUser -TwitterUsername 'MariusStorhaug123' } | Should -Not -Throw - { Update-GitHubUser -Company 'PSModule' } | Should -Not -Throw - { Update-GitHubUser -Location 'USA' } | Should -Not -Throw - { Update-GitHubUser -Bio 'I love programming' } | Should -Not -Throw + { Set-GitHubUser -Name 'Octocat' } | Should -Not -Throw + { Set-GitHubUser -Blog 'https://marius-storhaug.com' } | Should -Not -Throw + { Set-GitHubUser -TwitterUsername 'MariusStorhaug123' } | Should -Not -Throw + { Set-GitHubUser -Company 'PSModule' } | Should -Not -Throw + { Set-GitHubUser -Location 'USA' } | Should -Not -Throw + { Set-GitHubUser -Bio 'I love programming' } | Should -Not -Throw $tmpUser = Get-GitHubUser $tmpUser.name | Should -Be 'Octocat' $tmpUser.blog | Should -Be 'https://marius-storhaug.com' @@ -385,12 +385,12 @@ Describe 'As a user - Fine-grained PAT token - user account access (USER_FG_PAT) $tmpUser.company | Should -Be 'PSModule' $tmpUser.location | Should -Be 'USA' $tmpUser.bio | Should -Be 'I love programming' - { Update-GitHubUser -Name $user.name } | Should -Not -Throw - { Update-GitHubUser -Blog $user.blog } | Should -Not -Throw - { Update-GitHubUser -TwitterUsername $user.twitter_username } | Should -Not -Throw - { Update-GitHubUser -Company $user.company } | Should -Not -Throw - { Update-GitHubUser -Location $user.location } | Should -Not -Throw - { Update-GitHubUser -Bio $user.bio } | Should -Not -Throw + { Set-GitHubUser -Name $user.name } | Should -Not -Throw + { Set-GitHubUser -Blog $user.blog } | Should -Not -Throw + { Set-GitHubUser -TwitterUsername $user.twitter_username } | Should -Not -Throw + { Set-GitHubUser -Company $user.company } | Should -Not -Throw + { Set-GitHubUser -Location $user.location } | Should -Not -Throw + { Set-GitHubUser -Bio $user.bio } | Should -Not -Throw # $user = @{ # Name = $user.name # Blog = $user.blog @@ -399,7 +399,7 @@ Describe 'As a user - Fine-grained PAT token - user account access (USER_FG_PAT) # Location = $user.location # Bio = $user.bio # } - # Update-GitHubUser @user + # Set-GitHubUser @user } } } @@ -637,7 +637,7 @@ Describe 'As a user - Classic PAT token (PAT)' { It 'Get-GitHubUser - Get the specified user (PAT)' { { Get-GitHubUser -Username 'Octocat' } | Should -Not -Throw } - It 'Update-GitHubUser - Can set configuration on a user (PAT)' { + It 'Set-GitHubUser - Can set configuration on a user (PAT)' { # $params = @{ # Name = 'Octocat' # Blog = 'https://marius-storhaug.com' @@ -646,14 +646,14 @@ Describe 'As a user - Classic PAT token (PAT)' { # Location = 'USA' # Bio = 'I love programming' # } - # { Update-GitHubUser @params } | Should -Not -Throw + # { Set-GitHubUser @params } | Should -Not -Throw $user = Get-GitHubUser - { Update-GitHubUser -Name 'Octocat' } | Should -Not -Throw - { Update-GitHubUser -Blog 'https://marius-storhaug.com' } | Should -Not -Throw - { Update-GitHubUser -TwitterUsername 'MariusStorhaug123' } | Should -Not -Throw - { Update-GitHubUser -Company 'PSModule' } | Should -Not -Throw - { Update-GitHubUser -Location 'USA' } | Should -Not -Throw - { Update-GitHubUser -Bio 'I love programming' } | Should -Not -Throw + { Set-GitHubUser -Name 'Octocat' } | Should -Not -Throw + { Set-GitHubUser -Blog 'https://marius-storhaug.com' } | Should -Not -Throw + { Set-GitHubUser -TwitterUsername 'MariusStorhaug123' } | Should -Not -Throw + { Set-GitHubUser -Company 'PSModule' } | Should -Not -Throw + { Set-GitHubUser -Location 'USA' } | Should -Not -Throw + { Set-GitHubUser -Bio 'I love programming' } | Should -Not -Throw $tmpUser = Get-GitHubUser $tmpUser.name | Should -Be 'Octocat' $tmpUser.blog | Should -Be 'https://marius-storhaug.com' @@ -661,12 +661,12 @@ Describe 'As a user - Classic PAT token (PAT)' { $tmpUser.company | Should -Be 'PSModule' $tmpUser.location | Should -Be 'USA' $tmpUser.bio | Should -Be 'I love programming' - { Update-GitHubUser -Name $user.name } | Should -Not -Throw - { Update-GitHubUser -Blog $user.blog } | Should -Not -Throw - { Update-GitHubUser -TwitterUsername $user.twitter_username } | Should -Not -Throw - { Update-GitHubUser -Company $user.company } | Should -Not -Throw - { Update-GitHubUser -Location $user.location } | Should -Not -Throw - { Update-GitHubUser -Bio $user.bio } | Should -Not -Throw + { Set-GitHubUser -Name $user.name } | Should -Not -Throw + { Set-GitHubUser -Blog $user.blog } | Should -Not -Throw + { Set-GitHubUser -TwitterUsername $user.twitter_username } | Should -Not -Throw + { Set-GitHubUser -Company $user.company } | Should -Not -Throw + { Set-GitHubUser -Location $user.location } | Should -Not -Throw + { Set-GitHubUser -Bio $user.bio } | Should -Not -Throw # $user = @{ # Name = $user.name # Blog = $user.blog @@ -675,7 +675,7 @@ Describe 'As a user - Classic PAT token (PAT)' { # Location = $user.location # Bio = $user.bio # } - # Update-GitHubUser @user + # Set-GitHubUser @user } } } diff --git a/tools/utilities/Local-Testing.ps1 b/tools/utilities/Local-Testing.ps1 index 24d3884bc..6906d16bf 100644 --- a/tools/utilities/Local-Testing.ps1 +++ b/tools/utilities/Local-Testing.ps1 @@ -57,10 +57,10 @@ Get-GitHubUser | Select-Object Name, login, ID, company, blog, twitter_username, $user = Get-GitHubUser $user.social_accounts -Update-GitHubUser -Company '@DNBBank' -Email 'marstor@hotmail.com' -Blog 'https://www.github.com/MariusStorhaug' -TwitterUsername MariusStorhaug -Location 'Norway' -Hireable $false -Bio 'DevOps Engineer at DNB Bank. I ❤️ PowerShell and automation.' -Update-GitHubUser -Company ' ' -Update-GitHubUser -Hireable $true | Select-Object login, hireable -Update-GitHubUser -Hireable $false | Select-Object login, hireable +Set-GitHubUser -Company '@DNBBank' -Email 'marstor@hotmail.com' -Blog 'https://www.github.com/MariusStorhaug' -TwitterUsername MariusStorhaug -Location 'Norway' -Hireable $false -Bio 'DevOps Engineer at DNB Bank. I ❤️ PowerShell and automation.' +Set-GitHubUser -Company ' ' +Set-GitHubUser -Hireable $true | Select-Object login, hireable +Set-GitHubUser -Hireable $false | Select-Object login, hireable Add-GitHubUserSocials -AccountUrls 'https://www.github.com/MariusStorhaug'