@@ -7,22 +7,23 @@ import (
77 "github.com/stretchr/testify/assert"
88 "github.com/stretchr/testify/require"
99 cca "github.com/stytchauth/stytch-management-go/v3/pkg/models/countrycodeallowlist"
10+ "github.com/stytchauth/stytch-management-go/v3/pkg/models/environments"
1011 "github.com/stytchauth/stytch-management-go/v3/pkg/models/projects"
1112)
1213
1314func TestCountryCodeAllowlistClient_GetAllowedSMSCountryCodes (t * testing.T ) {
1415 t .Run ("default country codes" , func (t * testing.T ) {
1516 // Arrange
1617 client := NewTestClient (t )
17- project := client .DisposableProject (projects .VerticalB2B )
18+ env := client .DisposableEnvironment (projects .VerticalB2B , environments . EnvironmentTypeTest )
1819 ctx := context .Background ()
1920 expected := []string {"CA" , "US" }
2021
2122 // Act
2223 resp , err := client .CountryCodeAllowlist .GetAllowedSMSCountryCodes (ctx ,
2324 & cca.GetAllowedSMSCountryCodesRequest {
24- ProjectSlug : project .ProjectSlug ,
25- EnvironmentSlug : TestEnvironment ,
25+ ProjectSlug : env .ProjectSlug ,
26+ EnvironmentSlug : env . EnvironmentSlug ,
2627 })
2728
2829 // Assert
@@ -32,22 +33,22 @@ func TestCountryCodeAllowlistClient_GetAllowedSMSCountryCodes(t *testing.T) {
3233 t .Run ("get country codes" , func (t * testing.T ) {
3334 // Arrange
3435 client := NewTestClient (t )
35- project := client .DisposableProject (projects .VerticalConsumer )
36+ env := client .DisposableEnvironment (projects .VerticalConsumer , environments . EnvironmentTypeTest )
3637 ctx := context .Background ()
3738 expected := []string {"CA" , "MX" , "US" }
3839 _ , err := client .CountryCodeAllowlist .SetAllowedSMSCountryCodes (ctx ,
3940 & cca.SetAllowedSMSCountryCodesRequest {
40- ProjectSlug : project .ProjectSlug ,
41- EnvironmentSlug : TestEnvironment ,
41+ ProjectSlug : env .ProjectSlug ,
42+ EnvironmentSlug : env . EnvironmentSlug ,
4243 CountryCodes : expected ,
4344 })
4445 require .NoError (t , err )
4546
4647 // Act
4748 resp , err := client .CountryCodeAllowlist .GetAllowedSMSCountryCodes (ctx ,
4849 & cca.GetAllowedSMSCountryCodesRequest {
49- ProjectSlug : project .ProjectSlug ,
50- EnvironmentSlug : TestEnvironment ,
50+ ProjectSlug : env .ProjectSlug ,
51+ EnvironmentSlug : env . EnvironmentSlug ,
5152 })
5253
5354 // Assert
@@ -63,7 +64,7 @@ func TestCountryCodeAllowlistClient_GetAllowedSMSCountryCodes(t *testing.T) {
6364 resp , err := client .CountryCodeAllowlist .GetAllowedSMSCountryCodes (ctx ,
6465 & cca.GetAllowedSMSCountryCodesRequest {
6566 ProjectSlug : "project-does-not-exist" ,
66- EnvironmentSlug : TestEnvironment ,
67+ EnvironmentSlug : "test" ,
6768 })
6869
6970 // Assert
@@ -76,15 +77,15 @@ func TestCountryCodeAllowlistClient_GetAllowedWhatsAppCountryCodes(t *testing.T)
7677 t .Run ("default country codes" , func (t * testing.T ) {
7778 // Arrange
7879 client := NewTestClient (t )
79- project := client .DisposableProject (projects .VerticalConsumer )
80+ env := client .DisposableEnvironment (projects .VerticalConsumer , environments . EnvironmentTypeTest )
8081 ctx := context .Background ()
8182 expected := []string {"CA" , "US" }
8283
8384 // Act
8485 resp , err := client .CountryCodeAllowlist .GetAllowedWhatsAppCountryCodes (ctx ,
8586 & cca.GetAllowedWhatsAppCountryCodesRequest {
86- ProjectSlug : project .ProjectSlug ,
87- EnvironmentSlug : TestEnvironment ,
87+ ProjectSlug : env .ProjectSlug ,
88+ EnvironmentSlug : env . EnvironmentSlug ,
8889 })
8990
9091 // Assert
@@ -94,22 +95,22 @@ func TestCountryCodeAllowlistClient_GetAllowedWhatsAppCountryCodes(t *testing.T)
9495 t .Run ("get country codes" , func (t * testing.T ) {
9596 // Arrange
9697 client := NewTestClient (t )
97- project := client .DisposableProject (projects .VerticalConsumer )
98+ env := client .DisposableEnvironment (projects .VerticalConsumer , environments . EnvironmentTypeTest )
9899 ctx := context .Background ()
99100 expected := []string {"CA" , "MX" , "US" }
100101 _ , err := client .CountryCodeAllowlist .SetAllowedWhatsAppCountryCodes (ctx ,
101102 & cca.SetAllowedWhatsAppCountryCodesRequest {
102- ProjectSlug : project .ProjectSlug ,
103- EnvironmentSlug : TestEnvironment ,
103+ ProjectSlug : env .ProjectSlug ,
104+ EnvironmentSlug : env . EnvironmentSlug ,
104105 CountryCodes : expected ,
105106 })
106107 require .NoError (t , err )
107108
108109 // Act
109110 resp , err := client .CountryCodeAllowlist .GetAllowedWhatsAppCountryCodes (ctx ,
110111 & cca.GetAllowedWhatsAppCountryCodesRequest {
111- ProjectSlug : project .ProjectSlug ,
112- EnvironmentSlug : TestEnvironment ,
112+ ProjectSlug : env .ProjectSlug ,
113+ EnvironmentSlug : env . EnvironmentSlug ,
113114 })
114115
115116 // Assert
@@ -119,14 +120,14 @@ func TestCountryCodeAllowlistClient_GetAllowedWhatsAppCountryCodes(t *testing.T)
119120 t .Run ("B2B WhatsApp not supported" , func (t * testing.T ) {
120121 // Arrange
121122 client := NewTestClient (t )
122- project := client .DisposableProject (projects .VerticalB2B )
123+ env := client .DisposableEnvironment (projects .VerticalB2B , environments . EnvironmentTypeTest )
123124 ctx := context .Background ()
124125
125126 // Act
126127 _ , err := client .CountryCodeAllowlist .GetAllowedWhatsAppCountryCodes (ctx ,
127128 & cca.GetAllowedWhatsAppCountryCodesRequest {
128- ProjectSlug : project .ProjectSlug ,
129- EnvironmentSlug : TestEnvironment ,
129+ ProjectSlug : env .ProjectSlug ,
130+ EnvironmentSlug : env . EnvironmentSlug ,
130131 })
131132
132133 // Assert
@@ -141,7 +142,7 @@ func TestCountryCodeAllowlistClient_GetAllowedWhatsAppCountryCodes(t *testing.T)
141142 resp , err := client .CountryCodeAllowlist .GetAllowedWhatsAppCountryCodes (ctx ,
142143 & cca.GetAllowedWhatsAppCountryCodesRequest {
143144 ProjectSlug : "project-does-not-exist" ,
144- EnvironmentSlug : TestEnvironment ,
145+ EnvironmentSlug : "test" ,
145146 })
146147
147148 // Assert
@@ -154,15 +155,15 @@ func TestCountryCodeAllowlistClient_SetAllowedSMSCountryCodes(t *testing.T) {
154155 t .Run ("set country codes" , func (t * testing.T ) {
155156 // Arrange
156157 client := NewTestClient (t )
157- project := client .DisposableProject (projects .VerticalConsumer )
158+ env := client .DisposableEnvironment (projects .VerticalConsumer , environments . EnvironmentTypeTest )
158159 ctx := context .Background ()
159160 expected := []string {"CA" , "MX" , "US" }
160161
161162 // Act
162163 setResp , err := client .CountryCodeAllowlist .SetAllowedSMSCountryCodes (ctx ,
163164 & cca.SetAllowedSMSCountryCodesRequest {
164- ProjectSlug : project .ProjectSlug ,
165- EnvironmentSlug : TestEnvironment ,
165+ ProjectSlug : env .ProjectSlug ,
166+ EnvironmentSlug : env . EnvironmentSlug ,
166167 CountryCodes : expected ,
167168 })
168169
@@ -172,8 +173,8 @@ func TestCountryCodeAllowlistClient_SetAllowedSMSCountryCodes(t *testing.T) {
172173
173174 getResp , err := client .CountryCodeAllowlist .GetAllowedSMSCountryCodes (ctx ,
174175 & cca.GetAllowedSMSCountryCodesRequest {
175- ProjectSlug : project .ProjectSlug ,
176- EnvironmentSlug : TestEnvironment ,
176+ ProjectSlug : env .ProjectSlug ,
177+ EnvironmentSlug : env . EnvironmentSlug ,
177178 })
178179 require .NoError (t , err )
179180 assert .Equal (t , expected , getResp .CountryCodes )
@@ -187,7 +188,7 @@ func TestCountryCodeAllowlistClient_SetAllowedSMSCountryCodes(t *testing.T) {
187188 _ , err := client .CountryCodeAllowlist .SetAllowedSMSCountryCodes (ctx ,
188189 & cca.SetAllowedSMSCountryCodesRequest {
189190 ProjectSlug : "project-does-not-exist" ,
190- EnvironmentSlug : TestEnvironment ,
191+ EnvironmentSlug : "test" ,
191192 CountryCodes : []string {"CA" , "MX" , "US" },
192193 })
193194
@@ -199,15 +200,15 @@ func TestCountryCodeAllowlistClient_SetAllowedWhatsAppCountryCodes(t *testing.T)
199200 t .Run ("set country codes" , func (t * testing.T ) {
200201 // Arrange
201202 client := NewTestClient (t )
202- project := client .DisposableProject (projects .VerticalConsumer )
203+ env := client .DisposableEnvironment (projects .VerticalConsumer , environments . EnvironmentTypeTest )
203204 ctx := context .Background ()
204205 expected := []string {"CA" , "MX" , "US" }
205206
206207 // Act
207208 setResp , err := client .CountryCodeAllowlist .SetAllowedWhatsAppCountryCodes (ctx ,
208209 & cca.SetAllowedWhatsAppCountryCodesRequest {
209- ProjectSlug : project .ProjectSlug ,
210- EnvironmentSlug : TestEnvironment ,
210+ ProjectSlug : env .ProjectSlug ,
211+ EnvironmentSlug : env . EnvironmentSlug ,
211212 CountryCodes : expected ,
212213 })
213214
@@ -217,23 +218,23 @@ func TestCountryCodeAllowlistClient_SetAllowedWhatsAppCountryCodes(t *testing.T)
217218
218219 getResp , err := client .CountryCodeAllowlist .GetAllowedWhatsAppCountryCodes (ctx ,
219220 & cca.GetAllowedWhatsAppCountryCodesRequest {
220- ProjectSlug : project .ProjectSlug ,
221- EnvironmentSlug : TestEnvironment ,
221+ ProjectSlug : env .ProjectSlug ,
222+ EnvironmentSlug : env . EnvironmentSlug ,
222223 })
223224 require .NoError (t , err )
224225 assert .Equal (t , expected , getResp .CountryCodes )
225226 })
226227 t .Run ("B2B WhatsApp not supported" , func (t * testing.T ) {
227228 // Arrange
228229 client := NewTestClient (t )
229- project := client .DisposableProject (projects .VerticalB2B )
230+ env := client .DisposableEnvironment (projects .VerticalB2B , environments . EnvironmentTypeTest )
230231 ctx := context .Background ()
231232
232233 // Act
233234 _ , err := client .CountryCodeAllowlist .SetAllowedWhatsAppCountryCodes (ctx ,
234235 & cca.SetAllowedWhatsAppCountryCodesRequest {
235- ProjectSlug : project .ProjectSlug ,
236- EnvironmentSlug : TestEnvironment ,
236+ ProjectSlug : env .ProjectSlug ,
237+ EnvironmentSlug : env . EnvironmentSlug ,
237238 CountryCodes : []string {"CA" , "MX" , "US" },
238239 })
239240
@@ -249,7 +250,7 @@ func TestCountryCodeAllowlistClient_SetAllowedWhatsAppCountryCodes(t *testing.T)
249250 _ , err := client .CountryCodeAllowlist .SetAllowedWhatsAppCountryCodes (ctx ,
250251 & cca.SetAllowedWhatsAppCountryCodesRequest {
251252 ProjectSlug : "project-does-not-exist" ,
252- EnvironmentSlug : TestEnvironment ,
253+ EnvironmentSlug : "test" ,
253254 CountryCodes : []string {"CA" , "MX" , "US" },
254255 })
255256
0 commit comments