markekraus / PSMSGraph

A PowerShell module for the Microsoft Graph API
MIT License
82 stars 21 forks source link

100% Code Coverage for Get-GraphOauthAuthorizationCode #18

Open markekraus opened 7 years ago

markekraus commented 7 years ago

Code coverage report: Covered 0 % of 53 analyzed Commands in Get-GraphOauthAuthorizationCode Missed commands:

Line Command
64 if (-not $pscmdlet.ShouldProcess($Application.ClientID)) { ...
67 $Client_Id = [System.Web.HttpUtility]::UrlEncode($Application.ClientId)
68 $Redirect_Uri = [System.Web.HttpUtility]::UrlEncode($Application.RedirectUri)
69 $Url = "{0}?response_type=code&redirect_uri={1}&client_id={2}" -f @( ...
70 $BaseURL
71 $Redirect_Uri
72 $Client_Id
74 Write-Verbose "URL: '$URL'"
75 $Params = @{ ...
76 TypeName = 'System.Windows.Forms.Form'
77 Property = @{ ...
78 Width = 440
79 Height = 640
82 $Form = New-Object @Params
83 $Params = @{ ...
84 TypeName = 'System.Windows.Forms.WebBrowser'
85 Property = @{ ...
86 Width = 420
87 Height = 600
88 Url = $Url
91 $Web = New-Object @Params
92 $DocumentCompleted_Script = { ...
93 if ($web.Url.AbsoluteUri -match "error=[^&]*...
94 $form.Close()
98 $web.ScriptErrorsSuppressed = $false
99 $web.Add_DocumentCompleted($DocumentCompleted_Script)
100 $form.Controls.Add($web)
101 $form.Add_Shown({ $form.Activate() })
101 $form.Activate()
102 [void]$form.ShowDialog()
104 $QueryOutput = [System.Web.HttpUtility]::ParseQueryString($web.Url.Query)
105 $Response = @{ }
106 $queryOutput.Keys
107 $Response["$key"] = $QueryOutput[$key]
109 $SecAuthCode = 'NOAUTHCODE' ...
109 $SecAuthCode = 'NOAUTHCODE' ...
110 $AuthCodeCredential = [pscredential]::new('NOAUTHCODE', $SecAuthCode)
111 if ($Response.Code) { ...
112 $SecAuthCode = $Response.Code ...
112 $SecAuthCode = $Response.Code ...
113 $AuthCodeCredential = [pscredential]::new('AuthCode', $SecAuthCode)
114 $Response.Remove('Code')
116 [pscustomobject]@{ ...
117 PSTypeName = 'MSGraphAPI.Oauth.AuthorizationCode'
118 AuthCodeCredential = $AuthCodeCredential
119 ResultURL = $web.Url.psobject.copy()
120 Application = $Application
121 AuthCodeBaseURL = $BaseURL
122 Response = $Response
123 Issued = Get-date
125 [void]$form.Close()
126 [void]$Web.Dispose()
127 [void]$Form.Dispose()