Update Get-GiteaFileContent tests to use 'Result' for status reporting instead of 'Success'
This commit is contained in:
@@ -21,7 +21,7 @@ Describe 'Get-GiteaFileContent' {
|
|||||||
$result = Get-GiteaFileContent -repoOwner 'user' -repoName 'repo' -filePath 'README.md' -token 'abc123'
|
$result = Get-GiteaFileContent -repoOwner 'user' -repoName 'repo' -filePath 'README.md' -token 'abc123'
|
||||||
|
|
||||||
$result | Should -Not -BeNullOrEmpty
|
$result | Should -Not -BeNullOrEmpty
|
||||||
$result.Success | Should -Be $true
|
$result.Result | Should -Be 'Success'
|
||||||
$result.Content | Should -Be ([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes('Hello World')))
|
$result.Content | Should -Be ([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes('Hello World')))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ Describe 'Get-GiteaFileContent' {
|
|||||||
$result = Get-GiteaFileContent -repoOwner 'user' -repoName 'repo' -filePath 'README.md' -token 'abc123' -decode
|
$result = Get-GiteaFileContent -repoOwner 'user' -repoName 'repo' -filePath 'README.md' -token 'abc123' -decode
|
||||||
|
|
||||||
$result | Should -Not -BeNullOrEmpty
|
$result | Should -Not -BeNullOrEmpty
|
||||||
$result.Success | Should -Be $true
|
$result.Result | Should -Be 'Success'
|
||||||
$result.Content | Should -Be 'Hello World'
|
$result.Content | Should -Be 'Hello World'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ Describe 'Get-GiteaFileContent' {
|
|||||||
It 'Should capture error and mark result as unsuccessful' {
|
It 'Should capture error and mark result as unsuccessful' {
|
||||||
$result = Get-GiteaFileContent -repoOwner 'user' -repoName 'repo' -filePath 'badfile.ps1' -token 'abc123'
|
$result = Get-GiteaFileContent -repoOwner 'user' -repoName 'repo' -filePath 'badfile.ps1' -token 'abc123'
|
||||||
|
|
||||||
$result.Success | Should -Be $false
|
$result.Result | Should -Be 'Failure'
|
||||||
$result.Error | Should -Match 'API call failed'
|
$result.Error | Should -Match 'API call failed'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,7 +103,7 @@ Describe 'Get-GiteaFileContent' {
|
|||||||
$result = Get-GiteaFileContent -repoOwner 'user' -repoName 'repo' -filePath 'testfile.txt' -token 'abc123'
|
$result = Get-GiteaFileContent -repoOwner 'user' -repoName 'repo' -filePath 'testfile.txt' -token 'abc123'
|
||||||
|
|
||||||
$result | Should -Not -BeNullOrEmpty
|
$result | Should -Not -BeNullOrEmpty
|
||||||
$result.Success | Should -Be $true
|
$result.Result | Should -Be 'Success'
|
||||||
$result.Content | Should -Be ([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes('Hello from API!')))
|
$result.Content | Should -Be ([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes('Hello from API!')))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ Describe 'Get-GiteaFileContent' {
|
|||||||
$result = Get-GiteaFileContent -repoOwner 'user' -repoName 'repo' -filePath 'testfile.txt' -token 'abc123' -decode
|
$result = Get-GiteaFileContent -repoOwner 'user' -repoName 'repo' -filePath 'testfile.txt' -token 'abc123' -decode
|
||||||
|
|
||||||
$result | Should -Not -BeNullOrEmpty
|
$result | Should -Not -BeNullOrEmpty
|
||||||
$result.Success | Should -Be $true
|
$result.Result | Should -Be 'Success'
|
||||||
$result.Content | Should -Be 'Hello from API!'
|
$result.Content | Should -Be 'Hello from API!'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user