Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyas-goenka committed Aug 13, 2024
1 parent b7a4a9d commit 0766b9c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/auth/login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,30 @@ func TestSetHost(t *testing.T) {

// Test error when both flag and argument are provided
persistentAuth.Host = "val from --host"
err := setHost(ctx, "profile-1", &persistentAuth, []string{"val from [HOST]"})
err := setHostAndAccountId(ctx, "profile-1", &persistentAuth, []string{"val from [HOST]"})
assert.EqualError(t, err, "please only provide a host as an argument or a flag, not both")

// Test setting host from flag
persistentAuth.Host = "val from --host"
err = setHost(ctx, "profile-1", &persistentAuth, []string{})
err = setHostAndAccountId(ctx, "profile-1", &persistentAuth, []string{})
assert.NoError(t, err)
assert.Equal(t, "val from --host", persistentAuth.Host)

// Test setting host from argument
persistentAuth.Host = ""
err = setHost(ctx, "profile-1", &persistentAuth, []string{"val from [HOST]"})
err = setHostAndAccountId(ctx, "profile-1", &persistentAuth, []string{"val from [HOST]"})
assert.NoError(t, err)
assert.Equal(t, "val from [HOST]", persistentAuth.Host)

// Test setting host from profile
persistentAuth.Host = ""
err = setHost(ctx, "profile-1", &persistentAuth, []string{})
err = setHostAndAccountId(ctx, "profile-1", &persistentAuth, []string{})
assert.NoError(t, err)
assert.Equal(t, "https://www.host1.com", persistentAuth.Host)

// Test setting host from profile
persistentAuth.Host = ""
err = setHost(ctx, "profile-2", &persistentAuth, []string{})
err = setHostAndAccountId(ctx, "profile-2", &persistentAuth, []string{})
assert.NoError(t, err)
assert.Equal(t, "https://www.host2.com", persistentAuth.Host)
}

0 comments on commit 0766b9c

Please sign in to comment.