Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

100% Code Coverage for Update-GraphOauthAccessToken #25

Open
markekraus opened this issue Apr 22, 2017 · 0 comments
Open

100% Code Coverage for Update-GraphOauthAccessToken #25

markekraus opened this issue Apr 22, 2017 · 0 comments

Comments

@markekraus
Copy link
Owner

Code coverage report:
Covered 0 % of 38 analyzed Commands in Update-GraphOauthAccessToken
Missed commands:

Line Command
72 [system.uri]::IsWellFormedUriString( ...
86 $AccessToken
87 Write-Verbose "Processing token '$($RefreshToken.GUID.ToString())'"
87 $RefreshToken.GUID.ToString()
88 If (!$AccessToken.isExpired -and !$Force -and (get-date) -lt $AccessToken.Expires.addseconds(-$RenewalPeriod)) { ...
88 get-date
89 Write-Verbose "Token is not expired. Skipping"
92 $Body = @( ...
93 'grant_type=refresh_token'
94 '&redirect_uri={0}' -f [System.Web.HttpUtility]::UrlEncode($RefreshToken.Application.RedirectUri)
95 '&client_id={0}' -f [System.Web.HttpUtility]::UrlEncode($RefreshToken.Application.ClientID)
96 '&client_secret={0}' -f [System.Web.HttpUtility]::UrlEncode($RefreshToken.Application.GetClientSecret())
97 '&refresh_token={0}' -f [System.Web.HttpUtility]::UrlEncode($RefreshToken.GetRefreshToken())
98 '&resource={0}' -f [System.Web.HttpUtility]::UrlEncode($RefreshToken.Resource)
100 $Params = @{ ...
101 Uri = $BaseUrl
102 WebSession = $RefreshToken.Session
103 Method = 'POST'
104 Body = $Body
106 $RequestTime = Get-Date
108 $WebRequest = Invoke-WebRequest @Params
111 $ErrorMessage = $_.Exception.Message
112 Write-Error "Failed to refresh token: $ErrorMessage"
116 $Content = $WebRequest.Content ...
116 $Content = $WebRequest.Content ...
119 $ErrorMessage = $_.Exception.Message
120 $Message = "Failed to convert response from JSON: {0}" -f $ErrorMessage
121 Write-Error $Message
122 Write-Error $WebRequest.Content
125 $RefreshToken.AccessTokenCredential = [pscredential]::new('access_token', $($Content.access_token ...
125 $Content.access_token
125 ConvertTo-SecureString -AsPlainText -Force
126 $RefreshToken.Response = $Content ...
126 $RefreshToken.Response = $Content ...
127 $RefreshToken.RequestedDate = $RequestTime
129 if ($PassThru) { ...
130 Write-Verbose "Sending Token to the Pipeline"
131 $RefreshToken
@markekraus markekraus added this to the 100% Code Coverage milestone Apr 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant