Skip to content

Commit

Permalink
fix v3 site tests (#480)
Browse files Browse the repository at this point in the history
Co-authored-by: eilon.shai <[email protected]>
  • Loading branch information
eilon-shai and eilonshai authored Nov 28, 2024
1 parent dfc82a1 commit 21cdf85
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions incapsula/client_site_v3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ func TestAddV3SiteWithNameAndType(t *testing.T) {
log.Printf("[DEBUG] Running test client_site_v3_test.TestAddV3SiteWithName")

server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
if req.URL.String() != fmt.Sprintf("%s", endpointSiteV3) {
t.Errorf("Should have hit %s endpoint. Got: %s", endpointSiteV3, req.URL.String())
if req.URL.String() != fmt.Sprintf("%s", endpointSiteV3+"?caid=123") {
t.Errorf("Should have hit %s endpoint. Got: %s", endpointSiteV3+"?caid=123", req.URL.String())
}
rw.WriteHeader(200)
rw.Write([]byte("{\n \"data\": [\n {\n \"id\": 462102065,\n \"name\": \"de3affdrere.inddcapcwafteam.net\",\n \"type\": \"CLOUD_WAF\",\n \"accountId\": 51999737,\n \"creationTime\": 1717588301055,\n \"cname\": \"mhhp8q4.ng.impervadnsstage.net\"\n }\n ]\n}"))
Expand Down Expand Up @@ -71,8 +71,8 @@ func TestUpdateV3SiteWithName(t *testing.T) {
log.Printf("[DEBUG] Running test client_site_v3_test.TestAddV3SiteWithName")

server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
if req.URL.String() != fmt.Sprintf("%s", endpointSiteV3+"/111") {
t.Errorf("Should have hit %s endpoint. Got: %s", endpointSiteV3+"/111", req.URL.String())
if req.URL.String() != fmt.Sprintf("%s", endpointSiteV3+"/111?caid=123") {
t.Errorf("Should have hit %s endpoint. Got: %s", endpointSiteV3+"/111?caid=123", req.URL.String())
}
rw.WriteHeader(200)
rw.Write([]byte("{\n \"data\": [\n {\n \"id\": 462102065,\n \"name\": \"de3affdrere.inddcapcwafteam.net\",\n \"type\": \"CLOUD_WAF\",\n \"accountId\": 51999737,\n \"creationTime\": 1717588301055,\n \"cname\": \"mhhp8q4.ng.impervadnsstage.net\"\n }\n ]\n}"))
Expand Down Expand Up @@ -101,8 +101,8 @@ func TestDeleteV3Site(t *testing.T) {
log.Printf("[DEBUG] Running test client_site_v3_test.TestAddV3SiteWithName")

server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
if req.URL.String() != fmt.Sprintf("%s", endpointSiteV3+"/1234") {
t.Errorf("Should have hit %s endpoint. Got: %s", endpointSiteV3, req.URL.String())
if req.URL.String() != fmt.Sprintf("%s", endpointSiteV3+"/1234?caid=123") {
t.Errorf("Should have hit %s endpoint. Got: %s", endpointSiteV3+"/1234?caid=123", req.URL.String())
}
rw.WriteHeader(200)
rw.Write([]byte("{\n \"data\": [\n {\n \"id\": 462102065,\n \"name\": \"de3affdrere.inddcapcwafteam.net\",\n \"type\": \"CLOUD_WAF\",\n \"accountId\": 51999737,\n \"creationTime\": 1717588301055,\n \"cname\": \"mhhp8q4.ng.impervadnsstage.net\"\n }\n ]\n}"))
Expand Down

0 comments on commit 21cdf85

Please sign in to comment.