-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathEnterprise.Tests.ps1
More file actions
66 lines (62 loc) · 2.79 KB
/
Enterprise.Tests.ps1
File metadata and controls
66 lines (62 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#Requires -Modules @{ ModuleName = 'Pester'; RequiredVersion = '5.7.1' }
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
'PSUseDeclaredVarsMoreThanAssignments', '',
Justification = 'Pester grouping syntax: known issue.'
)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
'PSAvoidUsingConvertToSecureStringWithPlainText', '',
Justification = 'Used to create a secure string for testing.'
)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
'PSAvoidUsingWriteHost', '',
Justification = 'Log outputs to GitHub Actions logs.'
)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
'PSAvoidLongLines', '',
Justification = 'Long test descriptions and skip switches'
)]
[CmdletBinding()]
param()
Describe 'Template' {
$authCases = . "$PSScriptRoot/Data/AuthCases.ps1"
Context 'As <Type> using <Case> on <Target>' -ForEach $authCases {
BeforeAll {
$context = Connect-GitHubAccount @connectParams -PassThru -Silent
LogGroup 'Context' {
Write-Host ($context | Format-List | Out-String)
}
if ($AuthType -eq 'APP') {
LogGroup 'Context - Installation' {
$context = Connect-GitHubApp @connectAppParams -PassThru -Default -Silent
Write-Host ($context | Format-List | Out-String)
}
}
}
AfterAll {
Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount -Silent
Write-Host ('-' * 60)
}
It 'Get-GitHubEnterprise - Can get info about an enterprise' -Skip:($OwnerType -ne 'enterprise') {
$enterprise = Get-GitHubEnterprise -Name $Owner
LogGroup 'Enterprise' {
Write-Host ($enterprise | Select-Object * | Out-String)
}
$enterprise | Should -Not -BeNullOrEmpty
$enterprise | Should -BeOfType 'GitHubEnterprise'
$enterprise.Name | Should -Be 'msx'
$enterprise.DisplayName | Should -Be 'MSX'
$enterprise.ID | Should -Be 15567
$enterprise.NodeID | Should -Be 'E_kgDNPM8'
$enterprise.AvatarUrl | Should -Be 'https://avatars.githubusercontent.com/b/15567?v=4'
$enterprise.Url | Should -Be 'https://github.com/enterprises/msx'
$enterprise.Type | Should -Be 'Enterprise'
$enterprise.Readme | Should -Be 'This is a test'
$enterprise.ReadmeHTML | Should -Be '<p>This is a test</p>'
$enterprise.CreatedAt | Should -BeOfType 'DateTime'
$enterprise.UpdatedAt | Should -BeOfType 'DateTime'
$enterprise.Description | Should -Be 'This is the description'
$enterprise.Location | Should -Be 'Oslo, Norway'
$enterprise.Website | Should -Be 'https://msx.no'
}
}
}