Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BrachaY committed Jan 18, 2024
1 parent 7866431 commit 56a851d
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions incapsula/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,18 @@ func TestMissingBaseURL(t *testing.T) {
}

func TestMissingBaseURLRev2(t *testing.T) {
config := Config{APIID: "foo", APIKey: "bar", BaseURL: "foobar.com", BaseURLRev2: ""}
config := Config{APIID: "foo", APIKey: "bar", BaseURL: "foobar.com", BaseURLRev2: "", BaseURLRev3: "foobar.com"}
client, err := config.Client()
if err == nil {
t.Errorf("Should have received an error, got a client: %q", client)
}
if err.Error() != missingBaseURLRev2Message {
t.Errorf("Should have received missing Base URL Revision 2 message, got: %s", err)
}
}

func TestMissingBaseURLRev3(t *testing.T) {
config := Config{APIID: "foo", APIKey: "bar", BaseURL: "foobar.com", BaseURLRev2: "foobar.com", BaseURLRev3: ""}
client, err := config.Client()
if err == nil {
t.Errorf("Should have received an error, got a client: %q", client)
Expand All @@ -63,7 +74,7 @@ func TestMissingBaseURLRev2(t *testing.T) {
}

func TestMissingBaseURLAPI(t *testing.T) {
config := Config{APIID: "foo", APIKey: "bar", BaseURL: "foobar.com", BaseURLRev2: "foobar.com", BaseURLAPI: ""}
config := Config{APIID: "foo", APIKey: "bar", BaseURL: "foobar.com", BaseURLRev2: "foobar.com", BaseURLRev3: "foobar.com", BaseURLAPI: ""}
client, err := config.Client()
if err == nil {
t.Errorf("Should have received an error, got a client: %q", client)
Expand All @@ -82,7 +93,7 @@ func TestInvalidCredentials(t *testing.T) {
}))
defer server.Close()

config := Config{APIID: "bad", APIKey: "bad", BaseURL: server.URL, BaseURLRev2: server.URL, BaseURLAPI: server.URL}
config := Config{APIID: "bad", APIKey: "bad", BaseURL: server.URL, BaseURLRev2: server.URL, BaseURLRev3: server.URL, BaseURLAPI: server.URL}
client, err := config.Client()
if err == nil {
t.Errorf("Should have received an error, got a client: %q", client)
Expand All @@ -101,7 +112,7 @@ func TestValidCredentials(t *testing.T) {
}))
defer server.Close()

config := Config{APIID: "good", APIKey: "good", BaseURL: server.URL, BaseURLRev2: server.URL, BaseURLAPI: server.URL}
config := Config{APIID: "good", APIKey: "good", BaseURL: server.URL, BaseURLRev2: server.URL, BaseURLRev3: server.URL, BaseURLAPI: server.URL}
client, err := config.Client()
if err != nil {
t.Errorf("Should not have received an error, got: %s", err)
Expand Down

0 comments on commit 56a851d

Please sign in to comment.