From 3ff7cbf0fdcc55cf42ac116df429c170b1e382df Mon Sep 17 00:00:00 2001 From: Jacob Bednarz Date: Thu, 1 Jul 2021 12:07:49 +1000 Subject: [PATCH] tests: namespace `zoneID` and `accountID` placeholders Make it explicit these are used for tests and nothing more. --- access_application_test.go | 60 +++++++++++++------------- access_ca_certificate_test.go | 32 +++++++------- access_group_test.go | 44 +++++++++---------- access_identity_provider_test.go | 38 ++++++++-------- access_mutual_tls_certificates_test.go | 40 ++++++++--------- access_organization_test.go | 24 +++++------ access_policy_test.go | 44 +++++++++---------- access_service_tokens_test.go | 32 +++++++------- accounts_test.go | 4 +- consts.go | 4 +- device_posture_rule_test.go | 22 +++++----- dns_test.go | 26 +++++------ firewall_test.go | 40 ++++++++--------- keyless_test.go | 20 ++++----- lockdown_test.go | 20 ++++----- origin_ca_test.go | 2 - rate_limiting_test.go | 1 - teams_list_test.go | 30 ++++++------- universal_ssl_test.go | 6 --- waf_overrides_test.go | 2 - waf_test.go | 24 ----------- 21 files changed, 240 insertions(+), 275 deletions(-) diff --git a/access_application_test.go b/access_application_test.go index 18e7b289915..0653786d4a8 100644 --- a/access_application_test.go +++ b/access_application_test.go @@ -67,17 +67,17 @@ func TestAccessApplications(t *testing.T) { CustomDenyURL: "https://www.cloudflare.com", }} - mux.HandleFunc("/accounts/"+accountID+"/access/apps", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/apps", handler) - actual, _, err := client.AccessApplications(context.Background(), accountID, PaginationOptions{}) + actual, _, err := client.AccessApplications(context.Background(), testAccountID, PaginationOptions{}) if assert.NoError(t, err) { assert.Equal(t, want, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/apps", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/apps", handler) - actual, _, err = client.ZoneLevelAccessApplications(context.Background(), zoneID, PaginationOptions{}) + actual, _, err = client.ZoneLevelAccessApplications(context.Background(), testZoneID, PaginationOptions{}) if assert.NoError(t, err) { assert.Equal(t, want, actual) @@ -133,17 +133,17 @@ func TestAccessApplication(t *testing.T) { CustomDenyURL: "https://www.cloudflare.com", } - mux.HandleFunc("/accounts/"+accountID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) - actual, err := client.AccessApplication(context.Background(), accountID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") + actual, err := client.AccessApplication(context.Background(), testAccountID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") if assert.NoError(t, err) { assert.Equal(t, want, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) - actual, err = client.ZoneLevelAccessApplication(context.Background(), zoneID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") + actual, err = client.ZoneLevelAccessApplication(context.Background(), testZoneID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") if assert.NoError(t, err) { assert.Equal(t, want, actual) @@ -198,9 +198,9 @@ func TestCreateAccessApplications(t *testing.T) { UpdatedAt: &updatedAt, } - mux.HandleFunc("/accounts/"+accountID+"/access/apps", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/apps", handler) - actual, err := client.CreateAccessApplication(context.Background(), accountID, AccessApplication{ + actual, err := client.CreateAccessApplication(context.Background(), testAccountID, AccessApplication{ Name: "Admin Site", Domain: "test.example.com/admin", SessionDuration: "24h", @@ -210,9 +210,9 @@ func TestCreateAccessApplications(t *testing.T) { assert.Equal(t, fullAccessApplication, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/apps", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/apps", handler) - actual, err = client.CreateZoneLevelAccessApplication(context.Background(), zoneID, AccessApplication{ + actual, err = client.CreateZoneLevelAccessApplication(context.Background(), testZoneID, AccessApplication{ Name: "Admin Site", Domain: "test.example.com/admin", SessionDuration: "24h", @@ -271,17 +271,17 @@ func TestUpdateAccessApplication(t *testing.T) { UpdatedAt: &updatedAt, } - mux.HandleFunc("/accounts/"+accountID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) - actual, err := client.UpdateAccessApplication(context.Background(), accountID, fullAccessApplication) + actual, err := client.UpdateAccessApplication(context.Background(), testAccountID, fullAccessApplication) if assert.NoError(t, err) { assert.Equal(t, fullAccessApplication, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) - actual, err = client.UpdateZoneLevelAccessApplication(context.Background(), zoneID, fullAccessApplication) + actual, err = client.UpdateZoneLevelAccessApplication(context.Background(), testZoneID, fullAccessApplication) if assert.NoError(t, err) { assert.Equal(t, fullAccessApplication, actual) @@ -292,10 +292,10 @@ func TestUpdateAccessApplicationWithMissingID(t *testing.T) { setup() defer teardown() - _, err := client.UpdateAccessApplication(context.Background(), zoneID, AccessApplication{}) + _, err := client.UpdateAccessApplication(context.Background(), testZoneID, AccessApplication{}) assert.EqualError(t, err, "access application ID cannot be empty") - _, err = client.UpdateZoneLevelAccessApplication(context.Background(), zoneID, AccessApplication{}) + _, err = client.UpdateZoneLevelAccessApplication(context.Background(), testZoneID, AccessApplication{}) assert.EqualError(t, err, "access application ID cannot be empty") } @@ -317,13 +317,13 @@ func TestDeleteAccessApplication(t *testing.T) { `) } - mux.HandleFunc("/accounts/"+accountID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) - err := client.DeleteAccessApplication(context.Background(), accountID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") + mux.HandleFunc("/accounts/"+testAccountID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) + err := client.DeleteAccessApplication(context.Background(), testAccountID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") assert.NoError(t, err) - mux.HandleFunc("/zones/"+zoneID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) - err = client.DeleteZoneLevelAccessApplication(context.Background(), zoneID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") + mux.HandleFunc("/zones/"+testZoneID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) + err = client.DeleteZoneLevelAccessApplication(context.Background(), testZoneID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") assert.NoError(t, err) } @@ -343,13 +343,13 @@ func TestRevokeAccessApplicationTokens(t *testing.T) { `) } - mux.HandleFunc("/accounts/"+accountID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db/revoke-tokens", handler) - err := client.RevokeAccessApplicationTokens(context.Background(), accountID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") + mux.HandleFunc("/accounts/"+testAccountID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db/revoke-tokens", handler) + err := client.RevokeAccessApplicationTokens(context.Background(), testAccountID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") assert.NoError(t, err) - mux.HandleFunc("/zones/"+zoneID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db/revoke-tokens", handler) - err = client.RevokeZoneLevelAccessApplicationTokens(context.Background(), zoneID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") + mux.HandleFunc("/zones/"+testZoneID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db/revoke-tokens", handler) + err = client.RevokeZoneLevelAccessApplicationTokens(context.Background(), testZoneID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") assert.NoError(t, err) } @@ -411,17 +411,17 @@ func TestAccessApplicationWithCORS(t *testing.T) { }, } - mux.HandleFunc("/accounts/"+accountID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) - actual, err := client.AccessApplication(context.Background(), accountID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") + actual, err := client.AccessApplication(context.Background(), testAccountID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") if assert.NoError(t, err) { assert.Equal(t, want, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) - actual, err = client.ZoneLevelAccessApplication(context.Background(), zoneID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") + actual, err = client.ZoneLevelAccessApplication(context.Background(), testZoneID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") if assert.NoError(t, err) { assert.Equal(t, want, actual) diff --git a/access_ca_certificate_test.go b/access_ca_certificate_test.go index 1c0170a067a..d21141efe0e 100644 --- a/access_ca_certificate_test.go +++ b/access_ca_certificate_test.go @@ -35,17 +35,17 @@ func TestAcessCACertificate(t *testing.T) { PublicKey: "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTI...3urg/XpGMdgaSs5ZdptUPw= open-ssh-ca@cloudflareaccess.org", } - mux.HandleFunc("/accounts/"+accountID+"/access/apps/f174e90a-fafe-4643-bbbc-4a0ed4fc8415/ca", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/apps/f174e90a-fafe-4643-bbbc-4a0ed4fc8415/ca", handler) - actual, err := client.AccessCACertificate(context.Background(), accountID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") + actual, err := client.AccessCACertificate(context.Background(), testAccountID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") if assert.NoError(t, err) { assert.Equal(t, want, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/apps/f174e90a-fafe-4643-bbbc-4a0ed4fc8415/ca", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/apps/f174e90a-fafe-4643-bbbc-4a0ed4fc8415/ca", handler) - actual, err = client.ZoneLevelAccessCACertificate(context.Background(), zoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") + actual, err = client.ZoneLevelAccessCACertificate(context.Background(), testZoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") if assert.NoError(t, err) { assert.Equal(t, want, actual) @@ -78,17 +78,17 @@ func TestAcessCACertificates(t *testing.T) { PublicKey: "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTI...3urg/XpGMdgaSs5ZdptUPw= open-ssh-ca@cloudflareaccess.org", }} - mux.HandleFunc("/accounts/"+accountID+"/access/apps/ca", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/apps/ca", handler) - actual, err := client.AccessCACertificates(context.Background(), accountID) + actual, err := client.AccessCACertificates(context.Background(), testAccountID) if assert.NoError(t, err) { assert.Equal(t, want, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/apps/ca", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/apps/ca", handler) - actual, err = client.ZoneLevelAccessCACertificates(context.Background(), zoneID) + actual, err = client.ZoneLevelAccessCACertificates(context.Background(), testZoneID) if assert.NoError(t, err) { assert.Equal(t, want, actual) @@ -121,17 +121,17 @@ func TestCreateAcessCACertificates(t *testing.T) { PublicKey: "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTI...3urg/XpGMdgaSs5ZdptUPw= open-ssh-ca@cloudflareaccess.org", } - mux.HandleFunc("/accounts/"+accountID+"/access/apps/f174e90a-fafe-4643-bbbc-4a0ed4fc8415/ca", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/apps/f174e90a-fafe-4643-bbbc-4a0ed4fc8415/ca", handler) - actual, err := client.CreateAccessCACertificate(context.Background(), accountID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") + actual, err := client.CreateAccessCACertificate(context.Background(), testAccountID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") if assert.NoError(t, err) { assert.Equal(t, want, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/apps/f174e90a-fafe-4643-bbbc-4a0ed4fc8415/ca", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/apps/f174e90a-fafe-4643-bbbc-4a0ed4fc8415/ca", handler) - actual, err = client.CreateZoneLevelAccessCACertificate(context.Background(), zoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") + actual, err = client.CreateZoneLevelAccessCACertificate(context.Background(), testZoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") if assert.NoError(t, err) { assert.Equal(t, want, actual) @@ -156,15 +156,15 @@ func TestDeleteAcessCACertificates(t *testing.T) { `) } - mux.HandleFunc("/accounts/"+accountID+"/access/apps/f174e90a-fafe-4643-bbbc-4a0ed4fc8415/ca", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/apps/f174e90a-fafe-4643-bbbc-4a0ed4fc8415/ca", handler) - err := client.DeleteAccessCACertificate(context.Background(), accountID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") + err := client.DeleteAccessCACertificate(context.Background(), testAccountID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") assert.NoError(t, err) - mux.HandleFunc("/zones/"+zoneID+"/access/apps/f174e90a-fafe-4643-bbbc-4a0ed4fc8415/ca", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/apps/f174e90a-fafe-4643-bbbc-4a0ed4fc8415/ca", handler) - err = client.DeleteZoneLevelAccessCACertificate(context.Background(), zoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") + err = client.DeleteZoneLevelAccessCACertificate(context.Background(), testZoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") assert.NoError(t, err) } diff --git a/access_group_test.go b/access_group_test.go index 9207906a5fe..251561f1a8f 100644 --- a/access_group_test.go +++ b/access_group_test.go @@ -79,17 +79,17 @@ func TestAccessGroups(t *testing.T) { `) } - mux.HandleFunc("/accounts/"+accountID+"/access/groups", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/groups", handler) - actual, _, err := client.AccessGroups(context.Background(), accountID, pageOptions) + actual, _, err := client.AccessGroups(context.Background(), testAccountID, pageOptions) if assert.NoError(t, err) { assert.Equal(t, []AccessGroup{expectedAccessGroup}, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/groups", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/groups", handler) - actual, _, err = client.ZoneLevelAccessGroups(context.Background(), zoneID, pageOptions) + actual, _, err = client.ZoneLevelAccessGroups(context.Background(), testZoneID, pageOptions) if assert.NoError(t, err) { assert.Equal(t, []AccessGroup{expectedAccessGroup}, actual) @@ -138,17 +138,17 @@ func TestAccessGroup(t *testing.T) { `) } - mux.HandleFunc("/accounts/"+accountID+"/access/groups/"+accessGroupID, handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/groups/"+accessGroupID, handler) - actual, err := client.AccessGroup(context.Background(), accountID, accessGroupID) + actual, err := client.AccessGroup(context.Background(), testAccountID, accessGroupID) if assert.NoError(t, err) { assert.Equal(t, expectedAccessGroup, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/groups/"+accessGroupID, handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/groups/"+accessGroupID, handler) - actual, err = client.ZoneLevelAccessGroup(context.Background(), zoneID, accessGroupID) + actual, err = client.ZoneLevelAccessGroup(context.Background(), testZoneID, accessGroupID) if assert.NoError(t, err) { assert.Equal(t, expectedAccessGroup, actual) @@ -197,7 +197,7 @@ func TestCreateAccessGroup(t *testing.T) { `) } - mux.HandleFunc("/accounts/"+accountID+"/access/groups", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/groups", handler) accessGroup := AccessGroup{ Name: "Allow devs", @@ -218,15 +218,15 @@ func TestCreateAccessGroup(t *testing.T) { }, } - actual, err := client.CreateAccessGroup(context.Background(), accountID, accessGroup) + actual, err := client.CreateAccessGroup(context.Background(), testAccountID, accessGroup) if assert.NoError(t, err) { assert.Equal(t, expectedAccessGroup, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/groups", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/groups", handler) - actual, err = client.CreateZoneLevelAccessGroup(context.Background(), zoneID, accessGroup) + actual, err = client.CreateZoneLevelAccessGroup(context.Background(), testZoneID, accessGroup) if assert.NoError(t, err) { assert.Equal(t, expectedAccessGroup, actual) @@ -275,15 +275,15 @@ func TestUpdateAccessGroup(t *testing.T) { `) } - mux.HandleFunc("/accounts/"+accountID+"/access/groups/"+accessGroupID, handler) - actual, err := client.UpdateAccessGroup(context.Background(), accountID, expectedAccessGroup) + mux.HandleFunc("/accounts/"+testAccountID+"/access/groups/"+accessGroupID, handler) + actual, err := client.UpdateAccessGroup(context.Background(), testAccountID, expectedAccessGroup) if assert.NoError(t, err) { assert.Equal(t, expectedAccessGroup, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/groups/"+accessGroupID, handler) - actual, err = client.UpdateZoneLevelAccessGroup(context.Background(), zoneID, expectedAccessGroup) + mux.HandleFunc("/zones/"+testZoneID+"/access/groups/"+accessGroupID, handler) + actual, err = client.UpdateZoneLevelAccessGroup(context.Background(), testZoneID, expectedAccessGroup) if assert.NoError(t, err) { assert.Equal(t, expectedAccessGroup, actual) @@ -294,10 +294,10 @@ func TestUpdateAccessGroupWithMissingID(t *testing.T) { setup() defer teardown() - _, err := client.UpdateAccessGroup(context.Background(), accountID, AccessGroup{}) + _, err := client.UpdateAccessGroup(context.Background(), testAccountID, AccessGroup{}) assert.EqualError(t, err, "access group ID cannot be empty") - _, err = client.UpdateZoneLevelAccessGroup(context.Background(), zoneID, AccessGroup{}) + _, err = client.UpdateZoneLevelAccessGroup(context.Background(), testZoneID, AccessGroup{}) assert.EqualError(t, err, "access group ID cannot be empty") } @@ -319,13 +319,13 @@ func TestDeleteAccessGroup(t *testing.T) { `) } - mux.HandleFunc("/accounts/"+accountID+"/access/groups/"+accessGroupID, handler) - err := client.DeleteAccessGroup(context.Background(), accountID, accessGroupID) + mux.HandleFunc("/accounts/"+testAccountID+"/access/groups/"+accessGroupID, handler) + err := client.DeleteAccessGroup(context.Background(), testAccountID, accessGroupID) assert.NoError(t, err) - mux.HandleFunc("/zones/"+zoneID+"/access/groups/"+accessGroupID, handler) - err = client.DeleteZoneLevelAccessGroup(context.Background(), zoneID, accessGroupID) + mux.HandleFunc("/zones/"+testZoneID+"/access/groups/"+accessGroupID, handler) + err = client.DeleteZoneLevelAccessGroup(context.Background(), testZoneID, accessGroupID) assert.NoError(t, err) } diff --git a/access_identity_provider_test.go b/access_identity_provider_test.go index 128c6247032..3b69798ab9e 100644 --- a/access_identity_provider_test.go +++ b/access_identity_provider_test.go @@ -47,17 +47,17 @@ func TestAccessIdentityProviders(t *testing.T) { }, } - mux.HandleFunc("/accounts/"+accountID+"/access/identity_providers", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/identity_providers", handler) - actual, err := client.AccessIdentityProviders(context.Background(), accountID) + actual, err := client.AccessIdentityProviders(context.Background(), testAccountID) if assert.NoError(t, err) { assert.Equal(t, want, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/identity_providers", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/identity_providers", handler) - actual, err = client.ZoneLevelAccessIdentityProviders(context.Background(), zoneID) + actual, err = client.ZoneLevelAccessIdentityProviders(context.Background(), testZoneID) if assert.NoError(t, err) { assert.Equal(t, want, actual) @@ -98,17 +98,17 @@ func TestAccessIdentityProviderDetails(t *testing.T) { }, } - mux.HandleFunc("/accounts/"+accountID+"/access/identity_providers/f174e90a-fafe-4643-bbbc-4a0ed4fc841", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/identity_providers/f174e90a-fafe-4643-bbbc-4a0ed4fc841", handler) - actual, err := client.AccessIdentityProviderDetails(context.Background(), accountID, "f174e90a-fafe-4643-bbbc-4a0ed4fc841") + actual, err := client.AccessIdentityProviderDetails(context.Background(), testAccountID, "f174e90a-fafe-4643-bbbc-4a0ed4fc841") if assert.NoError(t, err) { assert.Equal(t, want, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/identity_providers/f174e90a-fafe-4643-bbbc-4a0ed4fc841", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/identity_providers/f174e90a-fafe-4643-bbbc-4a0ed4fc841", handler) - actual, err = client.ZoneLevelAccessIdentityProviderDetails(context.Background(), zoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc841") + actual, err = client.ZoneLevelAccessIdentityProviderDetails(context.Background(), testZoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc841") if assert.NoError(t, err) { assert.Equal(t, want, actual) @@ -158,17 +158,17 @@ func TestCreateAccessIdentityProvider(t *testing.T) { }, } - mux.HandleFunc("/accounts/"+accountID+"/access/identity_providers", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/identity_providers", handler) - actual, err := client.CreateAccessIdentityProvider(context.Background(), accountID, newIdentityProvider) + actual, err := client.CreateAccessIdentityProvider(context.Background(), testAccountID, newIdentityProvider) if assert.NoError(t, err) { assert.Equal(t, want, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/identity_providers", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/identity_providers", handler) - actual, err = client.CreateZoneLevelAccessIdentityProvider(context.Background(), zoneID, newIdentityProvider) + actual, err = client.CreateZoneLevelAccessIdentityProvider(context.Background(), testZoneID, newIdentityProvider) if assert.NoError(t, err) { assert.Equal(t, want, actual) @@ -217,17 +217,17 @@ func TestUpdateAccessIdentityProvider(t *testing.T) { }, } - mux.HandleFunc("/accounts/"+accountID+"/access/identity_providers/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/identity_providers/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) - actual, err := client.UpdateAccessIdentityProvider(context.Background(), accountID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", updatedIdentityProvider) + actual, err := client.UpdateAccessIdentityProvider(context.Background(), testAccountID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", updatedIdentityProvider) if assert.NoError(t, err) { assert.Equal(t, want, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/identity_providers/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/identity_providers/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) - actual, err = client.UpdateZoneLevelAccessIdentityProvider(context.Background(), zoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", updatedIdentityProvider) + actual, err = client.UpdateZoneLevelAccessIdentityProvider(context.Background(), testZoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", updatedIdentityProvider) if assert.NoError(t, err) { assert.Equal(t, want, actual) @@ -268,7 +268,7 @@ func TestDeleteAccessIdentityProvider(t *testing.T) { }, } - mux.HandleFunc("/accounts/"+accountID+"/access/identity_providers/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/identity_providers/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) actual, err := client.DeleteAccessIdentityProvider(context.Background(), "01a7362d577a6c3019a474fd6f485823", "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") @@ -276,9 +276,9 @@ func TestDeleteAccessIdentityProvider(t *testing.T) { assert.Equal(t, want, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/identity_providers/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/identity_providers/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) - actual, err = client.DeleteZoneLevelAccessIdentityProvider(context.Background(), zoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") + actual, err = client.DeleteZoneLevelAccessIdentityProvider(context.Background(), testZoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") if assert.NoError(t, err) { assert.Equal(t, want, actual) diff --git a/access_mutual_tls_certificates_test.go b/access_mutual_tls_certificates_test.go index b465f872726..fd567398c97 100644 --- a/access_mutual_tls_certificates_test.go +++ b/access_mutual_tls_certificates_test.go @@ -51,17 +51,17 @@ func TestAccessMutualTLSCertificates(t *testing.T) { AssociatedHostnames: []string{"admin.example.com"}, }} - mux.HandleFunc("/accounts/"+accountID+"/access/certificates", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/certificates", handler) - actual, err := client.AccessMutualTLSCertificates(context.Background(), accountID) + actual, err := client.AccessMutualTLSCertificates(context.Background(), testAccountID) if assert.NoError(t, err) { assert.Equal(t, want, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/certificates", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/certificates", handler) - actual, err = client.ZoneAccessMutualTLSCertificates(context.Background(), zoneID) + actual, err = client.ZoneAccessMutualTLSCertificates(context.Background(), testZoneID) if assert.NoError(t, err) { assert.Equal(t, want, actual) @@ -107,17 +107,17 @@ func TestAccessMutualTLSCertificate(t *testing.T) { AssociatedHostnames: []string{"admin.example.com"}, } - mux.HandleFunc("/accounts/"+accountID+"/access/certificates/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/certificates/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) - actual, err := client.AccessMutualTLSCertificate(context.Background(), accountID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") + actual, err := client.AccessMutualTLSCertificate(context.Background(), testAccountID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") if assert.NoError(t, err) { assert.Equal(t, want, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/certificates/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/certificates/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) - actual, err = client.ZoneAccessMutualTLSCertificate(context.Background(), zoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") + actual, err = client.ZoneAccessMutualTLSCertificate(context.Background(), testZoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") if assert.NoError(t, err) { assert.Equal(t, want, actual) @@ -168,17 +168,17 @@ func TestCreateAccessMutualTLSCertificate(t *testing.T) { AssociatedHostnames: []string{"admin.example.com"}, } - mux.HandleFunc("/accounts/"+accountID+"/access/certificates", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/certificates", handler) - actual, err := client.CreateAccessMutualTLSCertificate(context.Background(), accountID, certificate) + actual, err := client.CreateAccessMutualTLSCertificate(context.Background(), testAccountID, certificate) if assert.NoError(t, err) { assert.Equal(t, want, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/certificates", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/certificates", handler) - actual, err = client.CreateZoneAccessMutualTLSCertificate(context.Background(), zoneID, certificate) + actual, err = client.CreateZoneAccessMutualTLSCertificate(context.Background(), testZoneID, certificate) if assert.NoError(t, err) { assert.Equal(t, want, actual) @@ -229,17 +229,17 @@ func TestUpdateAccessMutualTLSCertificate(t *testing.T) { AssociatedHostnames: []string{"admin.example.com"}, } - mux.HandleFunc("/accounts/"+accountID+"/access/certificates/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/certificates/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) - actual, err := client.UpdateAccessMutualTLSCertificate(context.Background(), accountID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", certificate) + actual, err := client.UpdateAccessMutualTLSCertificate(context.Background(), testAccountID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", certificate) if assert.NoError(t, err) { assert.Equal(t, want, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/certificates/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/certificates/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) - actual, err = client.UpdateZoneAccessMutualTLSCertificate(context.Background(), zoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", certificate) + actual, err = client.UpdateZoneAccessMutualTLSCertificate(context.Background(), testZoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", certificate) if assert.NoError(t, err) { assert.Equal(t, want, actual) @@ -263,15 +263,15 @@ func TestDeleteAccessMutualTLSCertificate(t *testing.T) { }`) } - mux.HandleFunc("/accounts/"+accountID+"/access/certificates/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/certificates/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) - err := client.DeleteAccessMutualTLSCertificate(context.Background(), accountID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") + err := client.DeleteAccessMutualTLSCertificate(context.Background(), testAccountID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") assert.NoError(t, err) - mux.HandleFunc("/zones/"+zoneID+"/access/certificates/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/certificates/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) - err = client.DeleteZoneAccessMutualTLSCertificate(context.Background(), zoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") + err = client.DeleteZoneAccessMutualTLSCertificate(context.Background(), testZoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") assert.NoError(t, err) } diff --git a/access_organization_test.go b/access_organization_test.go index 17280606523..7f25a0febaf 100644 --- a/access_organization_test.go +++ b/access_organization_test.go @@ -51,17 +51,17 @@ func TestAccessOrganization(t *testing.T) { }, } - mux.HandleFunc("/accounts/"+accountID+"/access/organizations", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/organizations", handler) - actual, _, err := client.AccessOrganization(context.Background(), accountID) + actual, _, err := client.AccessOrganization(context.Background(), testAccountID) if assert.NoError(t, err) { assert.Equal(t, want, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/organizations", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/organizations", handler) - actual, _, err = client.ZoneLevelAccessOrganization(context.Background(), zoneID) + actual, _, err = client.ZoneLevelAccessOrganization(context.Background(), testZoneID) if assert.NoError(t, err) { assert.Equal(t, want, actual) @@ -109,17 +109,17 @@ func TestCreateAccessOrganization(t *testing.T) { }, } - mux.HandleFunc("/accounts/"+accountID+"/access/organizations", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/organizations", handler) - actual, err := client.CreateAccessOrganization(context.Background(), accountID, want) + actual, err := client.CreateAccessOrganization(context.Background(), testAccountID, want) if assert.NoError(t, err) { assert.Equal(t, want, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/organizations", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/organizations", handler) - actual, err = client.CreateZoneLevelAccessOrganization(context.Background(), zoneID, want) + actual, err = client.CreateZoneLevelAccessOrganization(context.Background(), testZoneID, want) if assert.NoError(t, err) { assert.Equal(t, want, actual) @@ -167,17 +167,17 @@ func TestUpdateAccessOrganization(t *testing.T) { }, } - mux.HandleFunc("/accounts/"+accountID+"/access/organizations", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/organizations", handler) - actual, err := client.UpdateAccessOrganization(context.Background(), accountID, want) + actual, err := client.UpdateAccessOrganization(context.Background(), testAccountID, want) if assert.NoError(t, err) { assert.Equal(t, want, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/organizations", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/organizations", handler) - actual, err = client.UpdateZoneLevelAccessOrganization(context.Background(), zoneID, want) + actual, err = client.UpdateZoneLevelAccessOrganization(context.Background(), testZoneID, want) if assert.NoError(t, err) { assert.Equal(t, want, actual) diff --git a/access_policy_test.go b/access_policy_test.go index 1eebe1bc174..4cd84aeca47 100644 --- a/access_policy_test.go +++ b/access_policy_test.go @@ -90,17 +90,17 @@ func TestAccessPolicies(t *testing.T) { `) } - mux.HandleFunc("/accounts/"+accountID+"/access/apps/"+accessApplicationID+"/policies", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/apps/"+accessApplicationID+"/policies", handler) - actual, _, err := client.AccessPolicies(context.Background(), accountID, accessApplicationID, pageOptions) + actual, _, err := client.AccessPolicies(context.Background(), testAccountID, accessApplicationID, pageOptions) if assert.NoError(t, err) { assert.Equal(t, []AccessPolicy{expectedAccessPolicy}, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/apps/"+accessApplicationID+"/policies", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/apps/"+accessApplicationID+"/policies", handler) - actual, _, err = client.ZoneLevelAccessPolicies(context.Background(), zoneID, accessApplicationID, pageOptions) + actual, _, err = client.ZoneLevelAccessPolicies(context.Background(), testZoneID, accessApplicationID, pageOptions) if assert.NoError(t, err) { assert.Equal(t, []AccessPolicy{expectedAccessPolicy}, actual) @@ -151,17 +151,17 @@ func TestAccessPolicy(t *testing.T) { `) } - mux.HandleFunc("/accounts/"+accountID+"/access/apps/"+accessApplicationID+"/policies/"+accessPolicyID, handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/apps/"+accessApplicationID+"/policies/"+accessPolicyID, handler) - actual, err := client.AccessPolicy(context.Background(), accountID, accessApplicationID, accessPolicyID) + actual, err := client.AccessPolicy(context.Background(), testAccountID, accessApplicationID, accessPolicyID) if assert.NoError(t, err) { assert.Equal(t, expectedAccessPolicy, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/apps/"+accessApplicationID+"/policies/"+accessPolicyID, handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/apps/"+accessApplicationID+"/policies/"+accessPolicyID, handler) - actual, err = client.ZoneLevelAccessPolicy(context.Background(), zoneID, accessApplicationID, accessPolicyID) + actual, err = client.ZoneLevelAccessPolicy(context.Background(), testZoneID, accessApplicationID, accessPolicyID) if assert.NoError(t, err) { assert.Equal(t, expectedAccessPolicy, actual) @@ -232,17 +232,17 @@ func TestCreateAccessPolicy(t *testing.T) { Decision: "allow", } - mux.HandleFunc("/accounts/"+accountID+"/access/apps/"+accessApplicationID+"/policies", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/apps/"+accessApplicationID+"/policies", handler) - actual, err := client.CreateAccessPolicy(context.Background(), accountID, accessApplicationID, accessPolicy) + actual, err := client.CreateAccessPolicy(context.Background(), testAccountID, accessApplicationID, accessPolicy) if assert.NoError(t, err) { assert.Equal(t, expectedAccessPolicy, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/apps/"+accessApplicationID+"/policies", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/apps/"+accessApplicationID+"/policies", handler) - actual, err = client.CreateZoneLevelAccessPolicy(context.Background(), zoneID, accessApplicationID, accessPolicy) + actual, err = client.CreateZoneLevelAccessPolicy(context.Background(), testZoneID, accessApplicationID, accessPolicy) if assert.NoError(t, err) { assert.Equal(t, expectedAccessPolicy, actual) @@ -293,15 +293,15 @@ func TestUpdateAccessPolicy(t *testing.T) { `) } - mux.HandleFunc("/accounts/"+accountID+"/access/apps/"+accessApplicationID+"/policies/"+accessPolicyID, handler) - actual, err := client.UpdateAccessPolicy(context.Background(), accountID, accessApplicationID, expectedAccessPolicy) + mux.HandleFunc("/accounts/"+testAccountID+"/access/apps/"+accessApplicationID+"/policies/"+accessPolicyID, handler) + actual, err := client.UpdateAccessPolicy(context.Background(), testAccountID, accessApplicationID, expectedAccessPolicy) if assert.NoError(t, err) { assert.Equal(t, expectedAccessPolicy, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/apps/"+accessApplicationID+"/policies/"+accessPolicyID, handler) - actual, err = client.UpdateZoneLevelAccessPolicy(context.Background(), zoneID, accessApplicationID, expectedAccessPolicy) + mux.HandleFunc("/zones/"+testZoneID+"/access/apps/"+accessApplicationID+"/policies/"+accessPolicyID, handler) + actual, err = client.UpdateZoneLevelAccessPolicy(context.Background(), testZoneID, accessApplicationID, expectedAccessPolicy) if assert.NoError(t, err) { assert.Equal(t, expectedAccessPolicy, actual) @@ -312,10 +312,10 @@ func TestUpdateAccessPolicyWithMissingID(t *testing.T) { setup() defer teardown() - _, err := client.UpdateAccessPolicy(context.Background(), accountID, accessApplicationID, AccessPolicy{}) + _, err := client.UpdateAccessPolicy(context.Background(), testAccountID, accessApplicationID, AccessPolicy{}) assert.EqualError(t, err, "access policy ID cannot be empty") - _, err = client.UpdateZoneLevelAccessPolicy(context.Background(), zoneID, accessApplicationID, AccessPolicy{}) + _, err = client.UpdateZoneLevelAccessPolicy(context.Background(), testZoneID, accessApplicationID, AccessPolicy{}) assert.EqualError(t, err, "access policy ID cannot be empty") } @@ -337,13 +337,13 @@ func TestDeleteAccessPolicy(t *testing.T) { `) } - mux.HandleFunc("/accounts/"+accountID+"/access/apps/"+accessApplicationID+"/policies/"+accessPolicyID, handler) - err := client.DeleteAccessPolicy(context.Background(), accountID, accessApplicationID, accessPolicyID) + mux.HandleFunc("/accounts/"+testAccountID+"/access/apps/"+accessApplicationID+"/policies/"+accessPolicyID, handler) + err := client.DeleteAccessPolicy(context.Background(), testAccountID, accessApplicationID, accessPolicyID) assert.NoError(t, err) - mux.HandleFunc("/zones/"+zoneID+"/access/apps/"+accessApplicationID+"/policies/"+accessPolicyID, handler) - err = client.DeleteZoneLevelAccessPolicy(context.Background(), zoneID, accessApplicationID, accessPolicyID) + mux.HandleFunc("/zones/"+testZoneID+"/access/apps/"+accessApplicationID+"/policies/"+accessPolicyID, handler) + err = client.DeleteZoneLevelAccessPolicy(context.Background(), testZoneID, accessApplicationID, accessPolicyID) assert.NoError(t, err) } diff --git a/access_service_tokens_test.go b/access_service_tokens_test.go index c6673673f7f..fd6df1c2b8b 100644 --- a/access_service_tokens_test.go +++ b/access_service_tokens_test.go @@ -50,17 +50,17 @@ func TestAccessServiceTokens(t *testing.T) { }, } - mux.HandleFunc("/accounts/"+accountID+"/access/service_tokens", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/service_tokens", handler) - actual, _, err := client.AccessServiceTokens(context.Background(), accountID) + actual, _, err := client.AccessServiceTokens(context.Background(), testAccountID) if assert.NoError(t, err) { assert.Equal(t, want, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/service_tokens", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/service_tokens", handler) - actual, _, err = client.ZoneLevelAccessServiceTokens(context.Background(), zoneID) + actual, _, err = client.ZoneLevelAccessServiceTokens(context.Background(), testZoneID) if assert.NoError(t, err) { assert.Equal(t, want, actual) @@ -101,17 +101,17 @@ func TestCreateAccessServiceToken(t *testing.T) { ClientSecret: "bdd31cbc4dec990953e39163fbbb194c93313ca9f0a6e420346af9d326b1d2a5", } - mux.HandleFunc("/accounts/"+accountID+"/access/service_tokens", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/service_tokens", handler) - actual, err := client.CreateAccessServiceToken(context.Background(), accountID, "CI/CD token") + actual, err := client.CreateAccessServiceToken(context.Background(), testAccountID, "CI/CD token") if assert.NoError(t, err) { assert.Equal(t, expected, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/service_tokens", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/service_tokens", handler) - actual, err = client.CreateZoneLevelAccessServiceToken(context.Background(), zoneID, "CI/CD token") + actual, err = client.CreateZoneLevelAccessServiceToken(context.Background(), testZoneID, "CI/CD token") if assert.NoError(t, err) { assert.Equal(t, expected, actual) @@ -150,17 +150,17 @@ func TestUpdateAccessServiceToken(t *testing.T) { ClientID: "88bf3b6d86161464f6509f7219099e57.access.example.com", } - mux.HandleFunc("/accounts/"+accountID+"/access/service_tokens/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/service_tokens/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) - actual, err := client.UpdateAccessServiceToken(context.Background(), accountID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "CI/CD token") + actual, err := client.UpdateAccessServiceToken(context.Background(), testAccountID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "CI/CD token") if assert.NoError(t, err) { assert.Equal(t, expected, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/service_tokens/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/service_tokens/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) - actual, err = client.UpdateZoneLevelAccessServiceToken(context.Background(), zoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "CI/CD token") + actual, err = client.UpdateZoneLevelAccessServiceToken(context.Background(), testZoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "CI/CD token") if assert.NoError(t, err) { assert.Equal(t, expected, actual) @@ -199,17 +199,17 @@ func TestDeleteAccessServiceToken(t *testing.T) { ClientID: "88bf3b6d86161464f6509f7219099e57.access.example.com", } - mux.HandleFunc("/accounts/"+accountID+"/access/service_tokens/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/access/service_tokens/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) - actual, err := client.DeleteAccessServiceToken(context.Background(), accountID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") + actual, err := client.DeleteAccessServiceToken(context.Background(), testAccountID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") if assert.NoError(t, err) { assert.Equal(t, expected, actual) } - mux.HandleFunc("/zones/"+zoneID+"/access/service_tokens/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) + mux.HandleFunc("/zones/"+testZoneID+"/access/service_tokens/f174e90a-fafe-4643-bbbc-4a0ed4fc8415", handler) - actual, err = client.DeleteZoneLevelAccessServiceToken(context.Background(), zoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") + actual, err = client.DeleteZoneLevelAccessServiceToken(context.Background(), testZoneID, "f174e90a-fafe-4643-bbbc-4a0ed4fc8415") if assert.NoError(t, err) { assert.Equal(t, expected, actual) diff --git a/accounts_test.go b/accounts_test.go index ba0091cb026..f0dbd4d7b3e 100644 --- a/accounts_test.go +++ b/accounts_test.go @@ -209,8 +209,8 @@ func TestDeleteAccount(t *testing.T) { `) } - mux.HandleFunc("/accounts/"+accountID, handler) - err := client.DeleteAccount(context.Background(), accountID) + mux.HandleFunc("/accounts/"+testAccountID, handler) + err := client.DeleteAccount(context.Background(), testAccountID) assert.NoError(t, err) } diff --git a/consts.go b/consts.go index 655439bccab..9f48f984498 100644 --- a/consts.go +++ b/consts.go @@ -11,6 +11,6 @@ const ( ZoneRouteRoot RouteRoot = "zones" // Used for testing - accountID = "01a7362d577a6c3019a474fd6f485823" - zoneID = "d56084adb405e0b7e32c52321bf07be6" + testAccountID = "01a7362d577a6c3019a474fd6f485823" + testZoneID = "d56084adb405e0b7e32c52321bf07be6" ) diff --git a/device_posture_rule_test.go b/device_posture_rule_test.go index a9353ffdf78..eb3c9569ab3 100644 --- a/device_posture_rule_test.go +++ b/device_posture_rule_test.go @@ -69,9 +69,9 @@ func TestDevicePostureRules(t *testing.T) { }, }} - mux.HandleFunc("/accounts/"+accountID+"/devices/posture", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/devices/posture", handler) - actual, _, err := client.DevicePostureRules(context.Background(), accountID) + actual, _, err := client.DevicePostureRules(context.Background(), testAccountID) if assert.NoError(t, err) { assert.Equal(t, want, actual) @@ -118,9 +118,9 @@ func TestDevicePostureRule(t *testing.T) { Input: DevicePostureRuleInput{ID: "9e597887-345e-4a32-a09c-68811b129768"}, } - mux.HandleFunc("/accounts/"+accountID+"/devices/posture/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/devices/posture/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) - actual, err := client.DevicePostureRule(context.Background(), accountID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") + actual, err := client.DevicePostureRule(context.Background(), testAccountID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") if assert.NoError(t, err) { assert.Equal(t, want, actual) @@ -167,9 +167,9 @@ func TestCreateDevicePostureRule(t *testing.T) { Input: DevicePostureRuleInput{ID: "9e597887-345e-4a32-a09c-68811b129768"}, } - mux.HandleFunc("/accounts/"+accountID+"/devices/posture", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/devices/posture", handler) - actual, err := client.CreateDevicePostureRule(context.Background(), accountID, DevicePostureRule{ + actual, err := client.CreateDevicePostureRule(context.Background(), testAccountID, DevicePostureRule{ Name: "My rule name", Description: "My description", Type: "file", @@ -223,9 +223,9 @@ func TestUpdateDevicePostureRule(t *testing.T) { Input: DevicePostureRuleInput{ID: "9e597887-345e-4a32-a09c-68811b129768"}, } - mux.HandleFunc("/accounts/"+accountID+"/devices/posture/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/devices/posture/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) - actual, err := client.UpdateDevicePostureRule(context.Background(), accountID, rule) + actual, err := client.UpdateDevicePostureRule(context.Background(), testAccountID, rule) if assert.NoError(t, err) { assert.Equal(t, rule, actual) @@ -236,7 +236,7 @@ func TestUpdateDevicePostureRuleWithMissingID(t *testing.T) { setup() defer teardown() - _, err := client.UpdateDevicePostureRule(context.Background(), zoneID, DevicePostureRule{}) + _, err := client.UpdateDevicePostureRule(context.Background(), testZoneID, DevicePostureRule{}) assert.EqualError(t, err, "device posture rule ID cannot be empty") } @@ -258,8 +258,8 @@ func TestDeleteDevicePostureRule(t *testing.T) { `) } - mux.HandleFunc("/accounts/"+accountID+"/devices/posture/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) - err := client.DeleteDevicePostureRule(context.Background(), accountID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") + mux.HandleFunc("/accounts/"+testAccountID+"/devices/posture/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) + err := client.DeleteDevicePostureRule(context.Background(), testAccountID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") assert.NoError(t, err) } diff --git a/dns_test.go b/dns_test.go index 0b3e670e52c..d4ece2618b6 100644 --- a/dns_test.go +++ b/dns_test.go @@ -62,7 +62,7 @@ func TestCreateDNSRecord(t *testing.T) { }`) } - mux.HandleFunc("/zones/"+zoneID+"/dns_records", handler) + mux.HandleFunc("/zones/"+testZoneID+"/dns_records", handler) createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00Z") modifiedOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00Z") @@ -75,7 +75,7 @@ func TestCreateDNSRecord(t *testing.T) { Proxiable: true, Proxied: input.Proxied, TTL: input.TTL, - ZoneID: zoneID, + ZoneID: testZoneID, ZoneName: "example.com", CreatedOn: createdOn, ModifiedOn: modifiedOn, @@ -88,7 +88,7 @@ func TestCreateDNSRecord(t *testing.T) { Response: Response{Success: true, Errors: []ResponseInfo{}, Messages: []ResponseInfo{}}, } - actual, err := client.CreateDNSRecord(context.Background(), zoneID, input) + actual, err := client.CreateDNSRecord(context.Background(), testZoneID, input) require.NoError(t, err) assert.Equal(t, want, actual) @@ -144,7 +144,7 @@ func TestDNSRecords(t *testing.T) { }`) } - mux.HandleFunc("/zones/"+zoneID+"/dns_records", handler) + mux.HandleFunc("/zones/"+testZoneID+"/dns_records", handler) proxied := false createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00Z") @@ -158,7 +158,7 @@ func TestDNSRecords(t *testing.T) { Proxied: &proxied, TTL: 120, Locked: false, - ZoneID: zoneID, + ZoneID: testZoneID, ZoneName: "example.com", CreatedOn: createdOn, ModifiedOn: modifiedOn, @@ -169,7 +169,7 @@ func TestDNSRecords(t *testing.T) { }, }} - actual, err := client.DNSRecords(context.Background(), zoneID, input) + actual, err := client.DNSRecords(context.Background(), testZoneID, input) require.NoError(t, err) assert.Equal(t, want, actual) @@ -211,7 +211,7 @@ func TestDNSRecord(t *testing.T) { dnsRecordID := "372e67954025e0ba6aaa6d586b9e0b59" - mux.HandleFunc("/zones/"+zoneID+"/dns_records/"+dnsRecordID, handler) + mux.HandleFunc("/zones/"+testZoneID+"/dns_records/"+dnsRecordID, handler) proxied := false createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00Z") @@ -224,7 +224,7 @@ func TestDNSRecord(t *testing.T) { Proxiable: true, Proxied: &proxied, TTL: 120, - ZoneID: zoneID, + ZoneID: testZoneID, ZoneName: "example.com", CreatedOn: createdOn, ModifiedOn: modifiedOn, @@ -235,7 +235,7 @@ func TestDNSRecord(t *testing.T) { }, } - actual, err := client.DNSRecord(context.Background(), zoneID, dnsRecordID) + actual, err := client.DNSRecord(context.Background(), testZoneID, dnsRecordID) require.NoError(t, err) assert.Equal(t, want, actual) @@ -335,9 +335,9 @@ func TestUpdateDNSRecord(t *testing.T) { dnsRecordID := "372e67954025e0ba6aaa6d586b9e0b59" - mux.HandleFunc("/zones/"+zoneID+"/dns_records/"+dnsRecordID, handler) + mux.HandleFunc("/zones/"+testZoneID+"/dns_records/"+dnsRecordID, handler) - err := client.UpdateDNSRecord(context.Background(), zoneID, dnsRecordID, input) + err := client.UpdateDNSRecord(context.Background(), testZoneID, dnsRecordID, input) require.NoError(t, err) } @@ -361,8 +361,8 @@ func TestDeleteDNSRecord(t *testing.T) { dnsRecordID := "372e67954025e0ba6aaa6d586b9e0b59" - mux.HandleFunc("/zones/"+zoneID+"/dns_records/"+dnsRecordID, handler) + mux.HandleFunc("/zones/"+testZoneID+"/dns_records/"+dnsRecordID, handler) - err := client.DeleteDNSRecord(context.Background(), zoneID, dnsRecordID) + err := client.DeleteDNSRecord(context.Background(), testZoneID, dnsRecordID) require.NoError(t, err) } diff --git a/firewall_test.go b/firewall_test.go index 47c790731bf..97b7ab09264 100644 --- a/firewall_test.go +++ b/firewall_test.go @@ -99,13 +99,13 @@ func TestListAccessRules(t *testing.T) { require.NoError(t, err) assert.Equal(t, want, actual) - mux.HandleFunc("/zones/"+zoneID+"/firewall/access_rules/rules", handler) - actual, err = client.ListZoneAccessRules(context.Background(), zoneID, accessRule, 1) + mux.HandleFunc("/zones/"+testZoneID+"/firewall/access_rules/rules", handler) + actual, err = client.ListZoneAccessRules(context.Background(), testZoneID, accessRule, 1) require.NoError(t, err) assert.Equal(t, want, actual) - mux.HandleFunc("/accounts/"+accountID+"/firewall/access_rules/rules", handler) - actual, err = client.ListAccountAccessRules(context.Background(), accountID, accessRule, 1) + mux.HandleFunc("/accounts/"+testAccountID+"/firewall/access_rules/rules", handler) + actual, err = client.ListAccountAccessRules(context.Background(), testAccountID, accessRule, 1) require.NoError(t, err) assert.Equal(t, want, actual) } @@ -186,13 +186,13 @@ func TestCreateAccessRule(t *testing.T) { require.NoError(t, err) assert.Equal(t, want, actual) - mux.HandleFunc("/zones/"+zoneID+"/firewall/access_rules/rules", handler) - actual, err = client.CreateZoneAccessRule(context.Background(), zoneID, input) + mux.HandleFunc("/zones/"+testZoneID+"/firewall/access_rules/rules", handler) + actual, err = client.CreateZoneAccessRule(context.Background(), testZoneID, input) require.NoError(t, err) assert.Equal(t, want, actual) - mux.HandleFunc("/accounts/"+accountID+"/firewall/access_rules/rules", handler) - actual, err = client.CreateAccountAccessRule(context.Background(), accountID, input) + mux.HandleFunc("/accounts/"+testAccountID+"/firewall/access_rules/rules", handler) + actual, err = client.CreateAccountAccessRule(context.Background(), testAccountID, input) require.NoError(t, err) assert.Equal(t, want, actual) } @@ -263,13 +263,13 @@ func TestAccessRule(t *testing.T) { require.NoError(t, err) assert.Equal(t, want, actual) - mux.HandleFunc("/zones/"+zoneID+"/firewall/access_rules/rules/"+accessRuleID, handler) - actual, err = client.ZoneAccessRule(context.Background(), zoneID, accessRuleID) + mux.HandleFunc("/zones/"+testZoneID+"/firewall/access_rules/rules/"+accessRuleID, handler) + actual, err = client.ZoneAccessRule(context.Background(), testZoneID, accessRuleID) require.NoError(t, err) assert.Equal(t, want, actual) - mux.HandleFunc("/accounts/"+accountID+"/firewall/access_rules/rules/"+accessRuleID, handler) - actual, err = client.AccountAccessRule(context.Background(), accountID, accessRuleID) + mux.HandleFunc("/accounts/"+testAccountID+"/firewall/access_rules/rules/"+accessRuleID, handler) + actual, err = client.AccountAccessRule(context.Background(), testAccountID, accessRuleID) require.NoError(t, err) assert.Equal(t, want, actual) } @@ -351,13 +351,13 @@ func TestUpdateAccessRule(t *testing.T) { require.NoError(t, err) assert.Equal(t, want, actual) - mux.HandleFunc("/zones/"+zoneID+"/firewall/access_rules/rules/"+accessRuleID, handler) - actual, err = client.UpdateZoneAccessRule(context.Background(), zoneID, accessRuleID, input) + mux.HandleFunc("/zones/"+testZoneID+"/firewall/access_rules/rules/"+accessRuleID, handler) + actual, err = client.UpdateZoneAccessRule(context.Background(), testZoneID, accessRuleID, input) require.NoError(t, err) assert.Equal(t, want, actual) - mux.HandleFunc("/accounts/"+accountID+"/firewall/access_rules/rules/"+accessRuleID, handler) - actual, err = client.UpdateAccountAccessRule(context.Background(), accountID, accessRuleID, input) + mux.HandleFunc("/accounts/"+testAccountID+"/firewall/access_rules/rules/"+accessRuleID, handler) + actual, err = client.UpdateAccountAccessRule(context.Background(), testAccountID, accessRuleID, input) require.NoError(t, err) assert.Equal(t, want, actual) } @@ -393,13 +393,13 @@ func TestDeleteAccessRule(t *testing.T) { require.NoError(t, err) assert.Equal(t, want, actual) - mux.HandleFunc("/zones/"+zoneID+"/firewall/access_rules/rules/"+accessRuleID, handler) - actual, err = client.DeleteZoneAccessRule(context.Background(), zoneID, accessRuleID) + mux.HandleFunc("/zones/"+testZoneID+"/firewall/access_rules/rules/"+accessRuleID, handler) + actual, err = client.DeleteZoneAccessRule(context.Background(), testZoneID, accessRuleID) require.NoError(t, err) assert.Equal(t, want, actual) - mux.HandleFunc("/accounts/"+accountID+"/firewall/access_rules/rules/"+accessRuleID, handler) - actual, err = client.DeleteAccountAccessRule(context.Background(), accountID, accessRuleID) + mux.HandleFunc("/accounts/"+testAccountID+"/firewall/access_rules/rules/"+accessRuleID, handler) + actual, err = client.DeleteAccountAccessRule(context.Background(), testAccountID, accessRuleID) require.NoError(t, err) assert.Equal(t, want, actual) } diff --git a/keyless_test.go b/keyless_test.go index b13df524cbd..c358a94377b 100644 --- a/keyless_test.go +++ b/keyless_test.go @@ -54,9 +54,9 @@ func TestCreateKeylessSSL(t *testing.T) { }`) } - mux.HandleFunc("/zones/"+zoneID+"/keyless_certificates", handler) + mux.HandleFunc("/zones/"+testZoneID+"/keyless_certificates", handler) - actual, err := client.CreateKeylessSSL(context.Background(), zoneID, input) + actual, err := client.CreateKeylessSSL(context.Background(), testZoneID, input) require.NoError(t, err) createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00Z") @@ -105,9 +105,9 @@ func TestListKeylessSSL(t *testing.T) { }`) } - mux.HandleFunc("/zones/"+zoneID+"/keyless_certificates", handler) + mux.HandleFunc("/zones/"+testZoneID+"/keyless_certificates", handler) - actual, err := client.ListKeylessSSL(context.Background(), zoneID) + actual, err := client.ListKeylessSSL(context.Background(), testZoneID) require.NoError(t, err) createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00Z") @@ -154,9 +154,9 @@ func TestKeylessSSL(t *testing.T) { }`) } - mux.HandleFunc("/zones/"+zoneID+"/keyless_certificates/"+"4d2844d2ce78891c34d0b6c0535a291e", handler) + mux.HandleFunc("/zones/"+testZoneID+"/keyless_certificates/"+"4d2844d2ce78891c34d0b6c0535a291e", handler) - actual, err := client.KeylessSSL(context.Background(), zoneID, "4d2844d2ce78891c34d0b6c0535a291e") + actual, err := client.KeylessSSL(context.Background(), testZoneID, "4d2844d2ce78891c34d0b6c0535a291e") require.NoError(t, err) createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00Z") @@ -217,9 +217,9 @@ func TestUpdateKeylessSSL(t *testing.T) { }`) } - mux.HandleFunc("/zones/"+zoneID+"/keyless_certificates/"+"4d2844d2ce78891c34d0b6c0535a291e", handler) + mux.HandleFunc("/zones/"+testZoneID+"/keyless_certificates/"+"4d2844d2ce78891c34d0b6c0535a291e", handler) - actual, err := client.UpdateKeylessSSL(context.Background(), zoneID, "4d2844d2ce78891c34d0b6c0535a291e", input) + actual, err := client.UpdateKeylessSSL(context.Background(), testZoneID, "4d2844d2ce78891c34d0b6c0535a291e", input) require.NoError(t, err) createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00Z") @@ -255,8 +255,8 @@ func TestDeleteKeylessSSL(t *testing.T) { }`) } - mux.HandleFunc("/zones/"+zoneID+"/keyless_certificates/"+"4d2844d2ce78891c34d0b6c0535a291e", handler) + mux.HandleFunc("/zones/"+testZoneID+"/keyless_certificates/"+"4d2844d2ce78891c34d0b6c0535a291e", handler) - err := client.DeleteKeylessSSL(context.Background(), zoneID, "4d2844d2ce78891c34d0b6c0535a291e") + err := client.DeleteKeylessSSL(context.Background(), testZoneID, "4d2844d2ce78891c34d0b6c0535a291e") require.NoError(t, err) } diff --git a/lockdown_test.go b/lockdown_test.go index f079cdb2f16..cdef49c1c99 100644 --- a/lockdown_test.go +++ b/lockdown_test.go @@ -58,9 +58,9 @@ func TestCreateZoneLockdown(t *testing.T) { }`) } - mux.HandleFunc("/zones/"+zoneID+"/firewall/lockdowns", handler) + mux.HandleFunc("/zones/"+testZoneID+"/firewall/lockdowns", handler) - actual, err := client.CreateZoneLockdown(context.Background(), zoneID, input) + actual, err := client.CreateZoneLockdown(context.Background(), testZoneID, input) require.NoError(t, err) createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00Z") @@ -132,9 +132,9 @@ func TestUpdateZoneLockdownt(t *testing.T) { zoneLockdownID := "372e67954025e0ba6aaa6d586b9e0b59" - mux.HandleFunc("/zones/"+zoneID+"/firewall/lockdowns/"+zoneLockdownID, handler) + mux.HandleFunc("/zones/"+testZoneID+"/firewall/lockdowns/"+zoneLockdownID, handler) - actual, err := client.UpdateZoneLockdown(context.Background(), zoneID, zoneLockdownID, input) + actual, err := client.UpdateZoneLockdown(context.Background(), testZoneID, zoneLockdownID, input) require.NoError(t, err) createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00Z") @@ -178,9 +178,9 @@ func TestDeleteZoneLockdown(t *testing.T) { zoneLockdownID := "372e67954025e0ba6aaa6d586b9e0b59" - mux.HandleFunc("/zones/"+zoneID+"/firewall/lockdowns/"+zoneLockdownID, handler) + mux.HandleFunc("/zones/"+testZoneID+"/firewall/lockdowns/"+zoneLockdownID, handler) - actual, err := client.DeleteZoneLockdown(context.Background(), zoneID, zoneLockdownID) + actual, err := client.DeleteZoneLockdown(context.Background(), testZoneID, zoneLockdownID) require.NoError(t, err) want := &ZoneLockdownResponse{ @@ -229,9 +229,9 @@ func TestZoneLockdown(t *testing.T) { zoneLockdownID := "372e67954025e0ba6aaa6d586b9e0b59" - mux.HandleFunc("/zones/"+zoneID+"/firewall/lockdowns/"+zoneLockdownID, handler) + mux.HandleFunc("/zones/"+testZoneID+"/firewall/lockdowns/"+zoneLockdownID, handler) - actual, err := client.ZoneLockdown(context.Background(), zoneID, zoneLockdownID) + actual, err := client.ZoneLockdown(context.Background(), testZoneID, zoneLockdownID) require.NoError(t, err) createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00Z") @@ -299,9 +299,9 @@ func TestListZoneLockdowns(t *testing.T) { } - mux.HandleFunc("/zones/"+zoneID+"/firewall/lockdowns", handler) + mux.HandleFunc("/zones/"+testZoneID+"/firewall/lockdowns", handler) - actual, err := client.ListZoneLockdowns(context.Background(), zoneID, 1) + actual, err := client.ListZoneLockdowns(context.Background(), testZoneID, 1) require.NoError(t, err) createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00Z") diff --git a/origin_ca_test.go b/origin_ca_test.go index e0b4e540ea8..216fb98b310 100644 --- a/origin_ca_test.go +++ b/origin_ca_test.go @@ -94,8 +94,6 @@ func TestOriginCA_OriginCertificates(t *testing.T) { setup() defer teardown() - testZoneID := "023e105f4ecef8ad9ca31a8372d0c353" - mux.HandleFunc("/certificates", func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, http.MethodGet, r.Method, "Expected method 'GET', got %ss", r.Method) assert.Equal(t, testZoneID, r.URL.Query().Get("zone_id"), "Expected zone_id '', got %%s", testZoneID) diff --git a/rate_limiting_test.go b/rate_limiting_test.go index 529b716b5ea..742e93e0c0d 100644 --- a/rate_limiting_test.go +++ b/rate_limiting_test.go @@ -12,7 +12,6 @@ import ( const ( rateLimitID = "72dae2fc158942f2adb1dd2a3d4143bc" - testZoneID = "abcd123" serverRateLimitDescription = `{ "id": "72dae2fc158942f2adb1dd2a3d4143bc", "disabled": false, diff --git a/teams_list_test.go b/teams_list_test.go index 3a3e704d585..70b6fdb501b 100644 --- a/teams_list_test.go +++ b/teams_list_test.go @@ -55,9 +55,9 @@ func TestTeamsLists(t *testing.T) { UpdatedAt: &updatedAt, }} - mux.HandleFunc("/accounts/"+accountID+"/gateway/lists", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/gateway/lists", handler) - actual, _, err := client.TeamsLists(context.Background(), accountID) + actual, _, err := client.TeamsLists(context.Background(), testAccountID) if assert.NoError(t, err) { assert.Equal(t, want, actual) @@ -101,9 +101,9 @@ func TestTeamsList(t *testing.T) { UpdatedAt: &updatedAt, } - mux.HandleFunc("/accounts/"+accountID+"/gateway/lists/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/gateway/lists/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) - actual, err := client.TeamsList(context.Background(), accountID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") + actual, err := client.TeamsList(context.Background(), testAccountID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") if assert.NoError(t, err) { assert.Equal(t, want, actual) @@ -148,9 +148,9 @@ func TestTeamsListItems(t *testing.T) { }, } - mux.HandleFunc("/accounts/"+accountID+"/gateway/lists/480f4f69-1a28-4fdd-9240-1ed29f0ac1db/items", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/gateway/lists/480f4f69-1a28-4fdd-9240-1ed29f0ac1db/items", handler) - actual, _, err := client.TeamsListItems(context.Background(), accountID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") + actual, _, err := client.TeamsListItems(context.Background(), testAccountID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") if assert.NoError(t, err) { assert.Equal(t, want, actual) } @@ -192,9 +192,9 @@ func TestCreateTeamsList(t *testing.T) { UpdatedAt: &updatedAt, } - mux.HandleFunc("/accounts/"+accountID+"/gateway/lists", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/gateway/lists", handler) - actual, err := client.CreateTeamsList(context.Background(), accountID, TeamsList{ + actual, err := client.CreateTeamsList(context.Background(), testAccountID, TeamsList{ Name: "My Serial List", Description: "My Description", Type: "SERIAL", @@ -242,9 +242,9 @@ func TestUpdateTeamsList(t *testing.T) { UpdatedAt: &updatedAt, } - mux.HandleFunc("/accounts/"+accountID+"/gateway/lists/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/gateway/lists/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) - actual, err := client.UpdateTeamsList(context.Background(), accountID, teamsList) + actual, err := client.UpdateTeamsList(context.Background(), testAccountID, teamsList) if assert.NoError(t, err) { assert.Equal(t, teamsList, actual) @@ -255,7 +255,7 @@ func TestUpdateTeamsListWithMissingID(t *testing.T) { setup() defer teardown() - _, err := client.UpdateTeamsList(context.Background(), zoneID, TeamsList{}) + _, err := client.UpdateTeamsList(context.Background(), testZoneID, TeamsList{}) assert.EqualError(t, err, "teams list ID cannot be empty") } @@ -295,9 +295,9 @@ func TestPatchTeamsList(t *testing.T) { UpdatedAt: &updatedAt, } - mux.HandleFunc("/accounts/"+accountID+"/gateway/lists/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) + mux.HandleFunc("/accounts/"+testAccountID+"/gateway/lists/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) - actual, err := client.PatchTeamsList(context.Background(), accountID, PatchTeamsList{ + actual, err := client.PatchTeamsList(context.Background(), testAccountID, PatchTeamsList{ ID: "480f4f69-1a28-4fdd-9240-1ed29f0ac1db", Append: []TeamsListItem{{Value: "abcd-1234"}}, Remove: []string{"def-5678"}, @@ -326,8 +326,8 @@ func TestDeleteTeamsList(t *testing.T) { `) } - mux.HandleFunc("/accounts/"+accountID+"/gateway/lists/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) - err := client.DeleteTeamsList(context.Background(), accountID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") + mux.HandleFunc("/accounts/"+testAccountID+"/gateway/lists/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler) + err := client.DeleteTeamsList(context.Background(), testAccountID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db") assert.NoError(t, err) } diff --git a/universal_ssl_test.go b/universal_ssl_test.go index 88035bad4a7..0138be5b21f 100644 --- a/universal_ssl_test.go +++ b/universal_ssl_test.go @@ -14,8 +14,6 @@ func TestUniversalSSLSettingDetails(t *testing.T) { setup() defer teardown() - testZoneID := "abcd123" - handler := func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, http.MethodGet, r.Method, "Expected method 'GET', got %s", r.Method) w.Header().Set("content-type", "application/json") @@ -45,8 +43,6 @@ func TestEditUniversalSSLSetting(t *testing.T) { setup() defer teardown() - testZoneID := "abcd123" - handler := func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, http.MethodPatch, r.Method, "Expected method 'PATCH', got %s", r.Method) body, err := ioutil.ReadAll(r.Body) @@ -84,8 +80,6 @@ func TestUniversalSSLVerificationDetails(t *testing.T) { setup() defer teardown() - testZoneID := "abcd123" - handler := func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, http.MethodGet, r.Method, "Expected method 'GET', got %s", r.Method) w.Header().Set("content-type", "application/json") diff --git a/waf_overrides_test.go b/waf_overrides_test.go index 34bdf32bc75..01d886490f7 100644 --- a/waf_overrides_test.go +++ b/waf_overrides_test.go @@ -61,8 +61,6 @@ func TestListWAFOverrides(t *testing.T) { setup() defer teardown() - testZoneID := "xyz123" - handler := func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, http.MethodGet, r.Method, "Expected method 'GET', got %s", r.Method) diff --git a/waf_test.go b/waf_test.go index 20881ed3d5c..88cec476024 100644 --- a/waf_test.go +++ b/waf_test.go @@ -16,8 +16,6 @@ func TestListWAFPackages(t *testing.T) { setup() defer teardown() - testZoneID := "abcd123" - handler := func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, http.MethodGet, r.Method, "Expected method 'GET', got %s", r.Method) @@ -74,8 +72,6 @@ func TestListWAFPackagesMultiplePages(t *testing.T) { setup() defer teardown() - testZoneID := "abcd123" - page := 1 handler := func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, http.MethodGet, r.Method, "Expected method 'GET', got %s", r.Method) @@ -152,8 +148,6 @@ func TestWAFPackage(t *testing.T) { setup() defer teardown() - testZoneID := "abcd123" - handler := func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, http.MethodGet, r.Method, "Expected method 'GET', got %s", r.Method) @@ -201,8 +195,6 @@ func TestUpdateWAFPackage(t *testing.T) { setup() defer teardown() - testZoneID := "abcd123" - handler := func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, http.MethodPatch, r.Method, "Expected method 'PATCH', got %s", r.Method) body, err := ioutil.ReadAll(r.Body) @@ -255,8 +247,6 @@ func TestListWAFGroups(t *testing.T) { setup() defer teardown() - testZoneID := "abcd123" - handler := func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, http.MethodGet, r.Method, "Expected method 'GET', got %s", r.Method) @@ -319,8 +309,6 @@ func TestListWAFGroups(t *testing.T) { func TestListWAFGroupsMultiplePages(t *testing.T) { setup() defer teardown() - - testZoneID := "abcd123" packageID := "efgh456" page := 1 @@ -406,8 +394,6 @@ func TestWAFGroup(t *testing.T) { setup() defer teardown() - testZoneID := "abcd123" - handler := func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, http.MethodGet, r.Method, "Expected method 'GET', got %s", r.Method) @@ -460,8 +446,6 @@ func TestUpdateWAFGroup(t *testing.T) { setup() defer teardown() - testZoneID := "abcd123" - handler := func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, http.MethodPatch, r.Method, "Expected method 'PATCH', got %s", r.Method) body, err := ioutil.ReadAll(r.Body) @@ -518,8 +502,6 @@ func TestListWAFRules(t *testing.T) { setup() defer teardown() - testZoneID := "abcd123" - handler := func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, http.MethodGet, r.Method, "Expected method 'GET', got %s", r.Method) @@ -589,8 +571,6 @@ func TestListWAFRules(t *testing.T) { func TestListWAFRulesMultiplePages(t *testing.T) { setup() defer teardown() - - testZoneID := "abcd123" packageID := "efgh456" page := 1 @@ -690,8 +670,6 @@ func TestWAFRule(t *testing.T) { setup() defer teardown() - testZoneID := "abcd123" - handler := func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, http.MethodGet, r.Method, "Expected method 'GET', got %s", r.Method) @@ -752,8 +730,6 @@ func TestUpdateWAFRule(t *testing.T) { setup() defer teardown() - testZoneID := "abcd123" - handler := func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, http.MethodPatch, r.Method, "Expected method 'PATCH', got %s", r.Method) body, err := ioutil.ReadAll(r.Body)