eclipse-archived / codewind-installer

The installation package for installing Codewind into an editor
https://codewind.dev
Eclipse Public License 2.0
5 stars 28 forks source link

use specific error for github authorization error #493

Closed jcockbain closed 4 years ago

jcockbain commented 4 years ago

Signed-off-by: James Cockbain james.cockbain@ibm.com

What type of PR is this ?

What does this PR do ?

Uses a specific error key (invalid_git_credentials) for whenever the Github API returns a 401 unauthorized error, when creating a project.

Example:

cwctl --json project create 
    -u https://github.ibm.com/James-Cockbain/git-basics 
    -p ~/documents/workspace/jam 
    --personalAccessToken no-token

{"error":"invalid_git_credentials","error_description":"unexpected status code: 401 Unauthorized"}
exit status 1

Modifies main tests to check for this error code in its existing bad password and access token tests.

Which issue(s) does this PR fix ?

https://github.com/eclipse/codewind/issues/3100

Does this PR require a documentation change ?

No

Any special notes for your reviewer ?

Modified tests require GHE credentials to be added in https://github.com/eclipse/codewind-installer/blob/master/pkg/test/globals.go.

jcockbain commented 4 years ago

@rwalle61 - that's correct. I can add that assertion 👍

codecov[bot] commented 4 years ago

Codecov Report

Merging #493 into master will increase coverage by 0.03%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #493      +/-   ##
==========================================
+ Coverage   19.83%   19.86%   +0.03%     
==========================================
  Files          80       80              
  Lines        7014     7017       +3     
==========================================
+ Hits         1391     1394       +3     
  Misses       5453     5453              
  Partials      170      170              
Impacted Files Coverage Δ
pkg/project/project_utils.go 0.00% <ø> (ø)
pkg/project/create.go 50.48% <100.00%> (+0.73%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c5a6baf...8146499. Read the comment docs.