Skip to content

Commit

Permalink
add more client tests
Browse files Browse the repository at this point in the history
  • Loading branch information
presbrey committed Aug 9, 2024
1 parent eacf565 commit 6e7aa1b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,30 @@ func TestAllProxiesUnavailable(t *testing.T) {
assert.Equal(t, 2, client.states[1].failureCount)
}

func TestClientGetError(t *testing.T) {
config := Config{
ProxyURLs: []string{"http://10.255.255.1:8080"},
DialTimeout: 5 * time.Second,
}

client, err := NewClient(config)
require.NoError(t, err)
_, err = client.Get("\000")
require.Error(t, err)
assert.Contains(t, err.Error(), "invalid control character")
}

func TestClientNewError(t *testing.T) {
config := Config{
ProxyURLs: []string{"\000"},
DialTimeout: 5 * time.Second,
}

_, err := NewClient(config)
require.Error(t, err)
assert.Contains(t, err.Error(), "invalid control character")
}

func TestClientWithNoProxyURLs(t *testing.T) {
config := Config{
ProxyURLs: []string{},
Expand Down

0 comments on commit 6e7aa1b

Please sign in to comment.