File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,17 +8,17 @@ Describe 'Toggl.API.Tests' {
88 It " should generate correct authorization header" {
99 $expected = ' Basic MTIzYTEyYWJjZDFhYjEyMzRkODZhNDcxZTkxNjI5NWM6YXBpX3Rva2Vu'
1010
11- $header = Get-TogglAuthHeader - ApiKey 123a12abcd1ab1234d86a471e916295c
11+ $header = Get-TogglAuthHeader - ApiToken 123a12abcd1ab1234d86a471e916295c
1212 $header.ContainsKey (' Authorization' ) | Should - Be $true
1313 $header.Authorization | Should Not BeNullOrEmpty
1414 $header.Authorization | Should - BeExactly $expected
1515 }
1616
17- It " given apiKey=<apiKey >, it throws exception" - TestCases @ (
18- @ { apiKey = " " }
19- @ { apiKey = $null }
17+ It " given apiToken=<apiToken >, it throws exception" - TestCases @ (
18+ @ { apiToken = " " }
19+ @ { apiToken = $null }
2020 ) {
21- { Get-TogglAuthHeader - ApiKey ' ' } | Should Throw " Cannot bind argument to parameter 'ApiKey ' because it is an empty string."
21+ { Get-TogglAuthHeader - ApiToken ' ' } | Should Throw " Cannot bind argument to parameter 'ApiToken ' because it is an empty string."
2222 }
2323 }
2424}
Original file line number Diff line number Diff line change 11function Get-TogglAuthHeader {
22 param (
33 [Parameter (Mandatory )]
4- [string ] $ApiKey
4+ [string ] $ApiToken
55 )
66
7- return @ { Authorization = " Basic " + [Convert ]::ToBase64String([Text.Encoding ]::UTF8.GetBytes(" $ApiKey `:api_token" )) }
7+ return @ { Authorization = " Basic " + [Convert ]::ToBase64String([Text.Encoding ]::UTF8.GetBytes(" $ApiToken `:api_token" )) }
88}
Original file line number Diff line number Diff line change 1+ $Global :TogglBaseUrl = " https://api.track.toggl.com/api/v9"
2+ $Global :TogglReportsBaseUrl = " https://api.track.toggl.com/reports/api/v3"
3+
14# Get public and private function definition files.
25$Public = @ ( Get-ChildItem - Path $PSScriptRoot \Public - Recurse - Filter * .ps1 - ErrorAction SilentlyContinue )
36$Private = @ ( Get-ChildItem - Path $PSScriptRoot \Private - Recurse - Filter * .ps1 - ErrorAction SilentlyContinue )
You can’t perform that action at this time.
0 commit comments