upbound / up

The @upbound CLI
Apache License 2.0
49 stars 42 forks source link

up space list against a disconnected space should return message to user #492

Closed tnthornton closed 2 months ago

tnthornton commented 2 months ago

Description of your changes

Prior to this changeset, if a user was not logged in to Upbound Cloud they would be presented with the following error when pointed at a disconnected space:

up: error: space.listCmd.Run(): failed to get Account "upbound": Unauthorized: {"message":"Unauthorized"}

Changes:

Relates to https://github.com/upbound/up/issues/487

I have:

How has this code been tested

New unit tests.

With a local build:

  1. Without logging in, attempted command and verified that I received expected message.
    ./_output/bin/darwin_arm64/up space list
    You must be logged in and authorized to list Upbound Cloud Spaces
  2. After logging in, verified that I could receive a list for the org that I was logged into.
    
    ./_output/bin/darwin_arm64/up alpha web-login
    taylor logged in

./_output/bin/darwin_arm64/up space list NAME MODE PROVIDER REGION upbound-legacy-gcp legacy gcp us-central-1 upbound-gcp-us-west-1 managed gcp us-west-1 upbound-aws-us-east-1 managed aws us-east-1 attached-gjsf9 connected attached-mmdmz connected borrelli-self-hosted connected bulat-kind-space connected erhan-test-space connected ezgi-space connected michael-test connected milo-space-2 connected milo-space-3 connected sumbrizzle connected

3. Logged out and attempted to list spaces again:

./_output/bin/darwin_arm64/up logout taylor logged out

./_output/bin/darwin_arm64/up space list You must be logged in and authorized to list Upbound Cloud Spaces


4. Verified that I could still install a space into a kind cluster.