@@ -24,6 +24,8 @@ import (
24
24
atlas "go.mongodb.org/atlas/mongodbatlas"
25
25
)
26
26
27
+ const accessListID = "5f3cf81b89034c6b3c0a528e"
28
+
27
29
func TestWhitelistAPIKeys_List (t * testing.T ) {
28
30
client , mux , teardown := setup ()
29
31
defer teardown ()
@@ -65,7 +67,7 @@ func TestWhitelistAPIKeys_List(t *testing.T) {
65
67
},
66
68
Results : []* GlobalWhitelistAPIKey {
67
69
{
68
- ID : "5f3cf81b89034c6b3c0a528e" ,
70
+ ID : accessListID ,
69
71
CidrBlock : "172.20.0.1" ,
70
72
Created : "2020-08-19T13:17:01Z" ,
71
73
Description : "test" ,
@@ -85,9 +87,7 @@ func TestWhitelistAPIKeys_Get(t *testing.T) {
85
87
client , mux , teardown := setup ()
86
88
defer teardown ()
87
89
88
- ipAddress := "5f3cf81b89034c6b3c0a528e"
89
-
90
- mux .HandleFunc (fmt .Sprintf ("/api/public/v1.0/admin/whitelist/%s" , ipAddress ), func (w http.ResponseWriter , r * http.Request ) {
90
+ mux .HandleFunc (fmt .Sprintf ("/api/public/v1.0/admin/whitelist/%s" , accessListID ), func (w http.ResponseWriter , r * http.Request ) {
91
91
testMethod (t , r , http .MethodGet )
92
92
fmt .Fprint (w , `{
93
93
"id": "5f3cf81b89034c6b3c0a528e",
@@ -99,13 +99,13 @@ func TestWhitelistAPIKeys_Get(t *testing.T) {
99
99
}` )
100
100
})
101
101
102
- whitelistAPIKey , _ , err := client .GlobalAPIKeysWhitelist .Get (ctx , ipAddress )
102
+ whitelistAPIKey , _ , err := client .GlobalAPIKeysWhitelist .Get (ctx , accessListID )
103
103
if err != nil {
104
104
t .Fatalf ("GlobalWhitelistAPIKeys.Get returned error: %v" , err )
105
105
}
106
106
107
107
expected := & GlobalWhitelistAPIKey {
108
- ID : "5f3cf81b89034c6b3c0a528e" ,
108
+ ID : accessListID ,
109
109
CidrBlock : "172.20.0.1" ,
110
110
Created : "2020-08-19T13:17:01Z" ,
111
111
Description : "test" ,
@@ -159,7 +159,7 @@ func TestWhitelistAPIKeys_Create(t *testing.T) {
159
159
}
160
160
161
161
expected := & GlobalWhitelistAPIKey {
162
- ID : "5f3cf81b89034c6b3c0a528e" ,
162
+ ID : accessListID ,
163
163
CidrBlock : "172.20.0.1" ,
164
164
Created : "2020-08-19T13:17:01Z" ,
165
165
Description : "test" ,
@@ -176,12 +176,11 @@ func TestWhitelistAPIKeys_Delete(t *testing.T) {
176
176
client , mux , teardown := setup ()
177
177
defer teardown ()
178
178
179
- ipAddress := "5f3cf81b89034c6b3c0a528e"
180
- mux .HandleFunc (fmt .Sprintf ("/api/public/v1.0/admin/whitelist/%s" , ipAddress ), func (w http.ResponseWriter , r * http.Request ) {
179
+ mux .HandleFunc (fmt .Sprintf ("/api/public/v1.0/admin/whitelist/%s" , accessListID ), func (w http.ResponseWriter , r * http.Request ) {
181
180
testMethod (t , r , http .MethodDelete )
182
181
})
183
182
184
- _ , err := client .GlobalAPIKeysWhitelist .Delete (ctx , ipAddress )
183
+ _ , err := client .GlobalAPIKeysWhitelist .Delete (ctx , accessListID )
185
184
if err != nil {
186
185
t .Fatalf ("GlobalWhitelistAPIKeys.Delete returned error: %v" , err )
187
186
}
0 commit comments