55 $TestProject = ' PSDevOps'
66)
77
8+ $IsFork = $env: SYSTEM_PULLREQUEST_ISFORK -eq ' true'
9+
10+ if ($IsFork ) {
11+ Write-Verbose " Build is from a fork - some tests will be skipped"
12+ }
13+
814Write-Verbose " Testing with $testOrg /$TestProject "
915
1016$testPat =
@@ -216,7 +222,7 @@ describe 'Calling REST APIs' {
216222 Invoke-ADORestAPI " https://dev.azure.com/$org /$project /_apis/build/builds/?api-version=5.1" - PSTypeName AzureDevOps.Build
217223 }
218224
219- it ' Can Connect to Azure DevOps (Connect-ADO)' {
225+ it ' Can Connect to Azure DevOps (Connect-ADO)' - Skip: $IsFork {
220226 $connection = Connect-ADO - Organization StartAutomating - PersonalAccessToken $testPat
221227 $connection.Organization | Should - Be StartAutomating
222228 }
@@ -238,7 +244,7 @@ describe 'Calling REST APIs' {
238244 Select-Object - ExpandProperty Name |
239245 Should - Be PSDevOps
240246 }
241- it ' Can create projects' {
247+ it ' Can create projects' - Skip: $IsFork {
242248 $whatIfResult =
243249 New-ADOProject - Name TestProject - Description " A Test Project" - Public - Abbreviation ' TP' - Organization StartAutomating - Process Agile - WhatIf - PersonalAccessToken $testPat
244250 $bodyObject = $whatIfResult.body | ConvertFrom-Json
@@ -302,7 +308,7 @@ describe 'Calling REST APIs' {
302308 Should - BeLike ' */git/repositories*'
303309 }
304310
305- it ' Can Remove Repositories' {
311+ it ' Can Remove Repositories' - Skip: $IsFork {
306312 $whatIf =
307313 Remove-ADORepository - Organization StartAutomating - Project PSDevOps - RepositoryID PSDevOps - WhatIf - PersonalAccessToken $testPat
308314 $whatIf.Method | Should - Be DELETE
@@ -325,7 +331,7 @@ describe 'Calling REST APIs' {
325331 $buildDefinitions.Count | should - BeGreaterThan 1
326332 $buildDefinitions [0 ].Name | should - beLike * PSDevOps*
327333 }
328- it ' Can get build -DefinitionYAML, given a build definition' {
334+ it ' Can get build -DefinitionYAML, given a build definition' - Skip: $IsFork {
329335 $buildDefinitionYaml = $ (Get-ADOBuild - Organization StartAutomating - Project PSDevOps - Definition |
330336 Select-Object - First 1 |
331337 Get-ADOBuild - DefinitionYAML - PersonalAccessToken $testPat )
@@ -385,11 +391,11 @@ describe 'Calling REST APIs' {
385391
386392 context ' Agent Pools' {
387393 # These tests will return nothing when run with a SystemAccessToken, so we will only fail if they error
388- it ' Can Get-ADOAgentPool for a given -Organization and -Project' {
394+ it ' Can Get-ADOAgentPool for a given -Organization and -Project' - Skip: $IsFork {
389395 Get-ADOAgentPool - Organization StartAutomating - Project PSDevOps - PersonalAccessToken $testPat - ErrorAction Stop
390396 }
391397
392- it ' Can Get-ADOAgentPool for a given -Organization' {
398+ it ' Can Get-ADOAgentPool for a given -Organization' - Skip: $IsFork {
393399 Get-ADOAgentPool - Organization StartAutomating - PersonalAccessToken $testPat - ErrorAction Stop
394400 }
395401
@@ -407,7 +413,7 @@ describe 'Calling REST APIs' {
407413 }
408414
409415 context ' Service Endpoints:' {
410- it ' Can Get-ADOServiceEndpoint' {
416+ it ' Can Get-ADOServiceEndpoint' - Skip: $IsFork {
411417 Get-ADOServiceEndpoint - Organization StartAutomating - Project PSDevOps - PersonalAccessToken $testPat - ErrorAction Stop
412418 }
413419
@@ -432,7 +438,7 @@ describe 'Calling REST APIs' {
432438 }
433439
434440 context ' Extensions' {
435- it ' Can Get-ADOExtension' {
441+ it ' Can Get-ADOExtension' - Skip: $IsFork {
436442 Get-ADOExtension - Organization StartAutomating - PersonalAccessToken $testPat - PublisherID ms - ExtensionID feed |
437443 Select-Object - First 1 - ExpandProperty PublisherName |
438444 should - Be Microsoft
@@ -446,35 +452,35 @@ describe 'Calling REST APIs' {
446452 #>
447453
448454
449- it ' Can Get-ADOExtension with filters' {
455+ it ' Can Get-ADOExtension with filters' - Skip: $IsFork {
450456 Get-ADOExtension - Organization StartAutomating - PersonalAccessToken $testPat - PublisherNameLike Micro* - ExtensionNameLike * feed* - PublisherNameMatch ms - ExtensionNameMatch feed |
451457 Select-Object - First 1 - ExpandProperty PublisherName |
452458 Should - Be Microsoft
453459 }
454460
455- it ' Can Install-ADOExtension' {
461+ it ' Can Install-ADOExtension' - Skip: $IsFork {
456462 $whatIf =
457463 Install-ADOExtension - Organization StartAutomating - PublisherID YodLabs - ExtensionID yodlabs- githubstats - WhatIf - PersonalAccessToken $testPat
458464 $whatIf.Method | Should - Be POST
459465 $whatIf.Uri | Should - BeLike ' */YodLabs/yodlabs-githubstats*'
460466 }
461467
462- it ' Can Uninstall-ADOExtension' {
468+ it ' Can Uninstall-ADOExtension' - Skip: $IsFork {
463469 $whatIf =
464470 Uninstall-ADOExtension - Organization StartAutomating - PublisherID YodLabs - ExtensionID yodlabs- githubstats - WhatIf - PersonalAccessToken $testPat
465471 $whatIf.Method | Should - Be DELETE
466472 $whatIf.Uri | Should - BeLike ' */YodLabs/yodlabs-githubstats*'
467473 }
468474
469- it ' Can Enable-ADOExtension' {
475+ it ' Can Enable-ADOExtension' - Skip: $IsFork {
470476 $whatIf =
471477 Enable-ADOExtension - Organization StartAutomating - PublisherID YodLabs - ExtensionID yodlabs- githubstats - WhatIf - PersonalAccessToken $testPat
472478 $whatIf.Method | Should - Be PATCH
473479 $whatIf.Uri | Should - BeLike ' */extensionmanagement/installedextensions*'
474480 $whatIf.body.installState.flags | Should - Be none
475481 }
476482
477- it ' Can Disable-ADOExtension' {
483+ it ' Can Disable-ADOExtension' - Skip: $IsFork {
478484 $whatIf =
479485 Disable-ADOExtension - Organization StartAutomating - PublisherID YodLabs - ExtensionID yodlabs- githubstats - WhatIf - PersonalAccessToken $testPat
480486 $whatIf.Method | Should - Be PATCH
@@ -484,7 +490,7 @@ describe 'Calling REST APIs' {
484490
485491
486492
487- it ' Get Get-ADOTask' {
493+ it ' Get Get-ADOTask' - Skip: $IsFork {
488494 Get-ADOTask - Organization StartAutomating - PersonalAccessToken $testPat |
489495 Select-Object - First 1 - ExpandProperty PSTypenames |
490496 Select-Object - Last 1 |
@@ -523,7 +529,7 @@ describe 'Calling REST APIs' {
523529 }
524530 }
525531
526- it ' Can clear widgets settings within dashboards' {
532+ it ' Can clear widgets settings within dashboards' - Skip: $IsFork {
527533 $whatIf = @ (Get-ADODashboard - Organization StartAutomating - PersonalAccessToken $testPat - Project PSDevOps - Team ' PSDevOps Team' |
528534 Select-Object - First 1 |
529535 Get-ADODashboard - Widget |
@@ -533,7 +539,7 @@ describe 'Calling REST APIs' {
533539 $whatIf.body.settings | Should - Be ' null'
534540 }
535541
536- it ' Can update dashboards' {
542+ it ' Can update dashboards' - Skip: $IsFork {
537543 $whatIf = Get-ADODashboard - Organization StartAutomating - PersonalAccessToken $testPat - Project PSDevOps - Team ' PSDevOps Team' |
538544 Get-ADODashboard - Widget |
539545 Select-Object - First 1 |
@@ -547,12 +553,12 @@ describe 'Calling REST APIs' {
547553 }
548554
549555 context ' Service Hooks' {
550- it ' Can Get Publishers of Service Hooks' {
556+ it ' Can Get Publishers of Service Hooks' - Skip: $IsFork {
551557 Get-ADOServiceHook - Organization StartAutomating - PersonalAccessToken $testPat - Publisher |
552558 Select-Object - First 1 - ExpandProperty ID |
553559 Should - be Audit
554560 }
555- it ' Can Get Consumers of Service Hooks' {
561+ it ' Can Get Consumers of Service Hooks' - Skip: $IsFork {
556562 Get-ADOServiceHook - Organization StartAutomating - PersonalAccessToken $testPat - Consumer |
557563 Select-Object - First 1 - ExpandProperty ID |
558564 Should - be appVeyor
@@ -603,22 +609,22 @@ describe 'Calling REST APIs' {
603609 }
604610
605611 context WorkProcesses {
606- it ' Can get work procceses related to a project' {
612+ it ' Can get work procceses related to a project' - Skip: $IsFork {
607613 Get-ADOProject - Organization StartAutomating - Project PSDevOps - PersonalAccessToken $testPat |
608614 Get-ADOWorkProcess |
609615 Select-Object - ExpandProperty Name |
610616 should - Be ' StartAutomating Basic'
611617 }
612618
613- it ' Can get work item types related to a process' {
619+ it ' Can get work item types related to a process' - Skip: $IsFork {
614620 Get-ADOProject - Organization StartAutomating - Project PSDevOps - PersonalAccessToken $testPat |
615621 Get-ADOWorkProcess |
616622 Get-ADOWorkItemType |
617623 Select-Object - First 1 - ExpandProperty Name |
618624 should - Be issue
619625 }
620626
621- it ' Can create new work item types' {
627+ it ' Can create new work item types' - Skip: $IsFork {
622628 $whatIfResult =
623629 Get-ADOProject - Organization StartAutomating - Project PSDevOps - PersonalAccessToken $testPat |
624630 Get-ADOWorkProcess |
@@ -628,7 +634,7 @@ describe 'Calling REST APIs' {
628634 should - Be icon_flame
629635 }
630636
631- it ' Can remove custom work item types' {
637+ it ' Can remove custom work item types' - Skip: $IsFork {
632638 $whatIfResult =
633639 Get-ADOProject - Organization StartAutomating - Project PSDevOps - PersonalAccessToken $testPat |
634640 Get-ADOWorkProcess |
0 commit comments