Skip to content

Commit 4ded2fa

Browse files
authored
Fix GitHub Repository Dependabot Functions Pipeline Input (#272)
Fixes the pipeline input for the following GitHub Repository functions: - `Disable-GitHubRepositoryVulnerabilityAlert` - `Enable-GitHubRepositorySecurityFix` - `Disable-GitHubRepositorySecurityFix` The unit tests for the functions are also updated to add pipeline tests. Fixes #270
1 parent 7de63ab commit 4ded2fa

File tree

2 files changed

+61
-4
lines changed

2 files changed

+61
-4
lines changed

GitHubRepositories.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2543,6 +2543,7 @@ filter Disable-GitHubRepositoryVulnerabilityAlert
25432543
Position = 1,
25442544
ValueFromPipelineByPropertyName,
25452545
ParameterSetName='Uri')]
2546+
[Alias('RepositoryUrl')]
25462547
[string] $Uri,
25472548

25482549
[string] $AccessToken,
@@ -2662,6 +2663,7 @@ filter Enable-GitHubRepositorySecurityFix
26622663
Position = 1,
26632664
ValueFromPipelineByPropertyName,
26642665
ParameterSetName='Uri')]
2666+
[Alias('RepositoryUrl')]
26652667
[string] $Uri,
26662668

26672669
[string] $AccessToken,
@@ -2780,6 +2782,7 @@ filter Disable-GitHubRepositorySecurityFix
27802782
Position = 1,
27812783
ValueFromPipelineByPropertyName,
27822784
ParameterSetName='Uri')]
2785+
[Alias('RepositoryUrl')]
27832786
[string] $Uri,
27842787

27852788
[string] $AccessToken,

Tests/GitHubRepositories.tests.ps1

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,6 +1246,16 @@ try
12461246
}
12471247
}
12481248

1249+
Context "When specifiying the 'URI' Parameter from the Pipeline" {
1250+
BeforeAll -ScriptBlock {
1251+
$status = $repo | Test-GitHubRepositoryVulnerabilityAlert
1252+
}
1253+
1254+
It 'Should return an object of the correct type' {
1255+
$status | Should -BeOfType System.Boolean
1256+
}
1257+
}
1258+
12491259
AfterAll -ScriptBlock {
12501260
Remove-GitHubRepository -Uri $repo.svn_url -Force
12511261
}
@@ -1263,6 +1273,17 @@ try
12631273
}
12641274
}
12651275

1276+
Context "When specifiying the 'URI' Parameter from the Pipeline" {
1277+
BeforeAll -ScriptBlock {
1278+
Disable-GitHubRepositoryVulnerabilityAlert -Uri $repo.svn_url
1279+
}
1280+
1281+
It 'Should not throw' {
1282+
{ $repo | Enable-GitHubRepositoryVulnerabilityAlert } |
1283+
Should -Not -Throw
1284+
}
1285+
}
1286+
12661287
AfterAll -ScriptBlock {
12671288
Remove-GitHubRepository -Uri $repo.svn_url -Force
12681289
}
@@ -1271,12 +1292,23 @@ try
12711292
Describe 'GitHubRepositories\Disable-GitHubRepositoryVulnerabilityAlert' {
12721293
BeforeAll {
12731294
$repo = New-GitHubRepository -RepositoryName ([Guid]::NewGuid().Guid)
1274-
Enable-GitHubRepositoryVulnerabilityAlert -Uri $repo.svn_url
1295+
Enable-GitHubRepositoryVulnerabilityAlert -Uri $repo.svn_url
12751296
}
12761297

12771298
Context 'When Disabling GitHub Repository Vulnerability Alerts' {
12781299
It 'Should not throw' {
1279-
{ Disable-GitHubRepositoryVulnerabilityAlert -Uri $repo.svn_url } |
1300+
{ Disable-GitHubRepositoryVulnerabilityAlert -Uri $repo.svn_url } |
1301+
Should -Not -Throw
1302+
}
1303+
}
1304+
1305+
Context "When specifiying the 'URI' Parameter from the Pipeline" {
1306+
BeforeAll -ScriptBlock {
1307+
Enable-GitHubRepositoryVulnerabilityAlert -Uri $repo.svn_url
1308+
}
1309+
1310+
It 'Should not throw' {
1311+
{ $repo | Disable-GitHubRepositoryVulnerabilityAlert } |
12801312
Should -Not -Throw
12811313
}
12821314
}
@@ -1294,7 +1326,18 @@ try
12941326

12951327
Context 'When Enabling GitHub Repository Security Fixes' {
12961328
It 'Should not throw' {
1297-
{ Enable-GitHubRepositorySecurityFix -Uri $repo.svn_url } |
1329+
{ Enable-GitHubRepositorySecurityFix -Uri $repo.svn_url } |
1330+
Should -Not -Throw
1331+
}
1332+
}
1333+
1334+
Context "When specifiying the 'URI' Parameter from the Pipeline" {
1335+
BeforeAll -ScriptBlock {
1336+
Disable-GitHubRepositorySecurityFix -Uri $repo.svn_url
1337+
}
1338+
1339+
It 'Should not throw' {
1340+
{ $repo | Enable-GitHubRepositorySecurityFix } |
12981341
Should -Not -Throw
12991342
}
13001343
}
@@ -1313,7 +1356,18 @@ try
13131356

13141357
Context 'When Disabling GitHub Repository Security Fixes' {
13151358
It 'Should not throw' {
1316-
{ Disable-GitHubRepositorySecurityFix -Uri $repo.svn_url } |
1359+
{ Disable-GitHubRepositorySecurityFix -Uri $repo.svn_url } |
1360+
Should -Not -Throw
1361+
}
1362+
}
1363+
1364+
Context "When specifiying the 'URI' Parameter from the Pipeline" {
1365+
BeforeAll -ScriptBlock {
1366+
Enable-GitHubRepositorySecurityFix -Uri $repo.svn_url
1367+
}
1368+
1369+
It 'Should not throw' {
1370+
{ $repo | Disable-GitHubRepositorySecurityFix } |
13171371
Should -Not -Throw
13181372
}
13191373
}

0 commit comments

Comments
 (0)