Skip to content

Commit 273814e

Browse files
committed
update smoke tests
1 parent c9fdcb2 commit 273814e

13 files changed

+151
-147
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
1616
BW_USERNAME: ${{ secrets.BW_USERNAME }}
1717
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
18+
BW_CLIENT_ID: ${{ secrets.BW_CLIENT_ID }}
19+
BW_CLIENT_SECRET: ${{ secrets.BW_CLIENT_SECRET }}
1820
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN}}
1921
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN}}
2022
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}

.github/workflows/test-pr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ env:
1313
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
1414
BW_USERNAME: ${{ secrets.BW_USERNAME }}
1515
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
16+
BW_CLIENT_ID: ${{ secrets.BW_CLIENT_ID }}
17+
BW_CLIENT_SECRET: ${{ secrets.BW_CLIENT_SECRET }}
1618
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN}}
1719
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN}}
1820
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}

.github/workflows/test-smoke.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ concurrency:
1515
env:
1616
BW_USERNAME: ${{ secrets.BW_USERNAME }}
1717
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
18+
BW_CLIENT_ID: ${{ secrets.BW_CLIENT_ID }}
19+
BW_CLIENT_SECRET: ${{ secrets.BW_CLIENT_SECRET }}
1820
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }}
1921
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }}
2022
USER_NUMBER: ${{ secrets.USER_NUMBER }}

src/Bandwidth.Standard.Test/Smoke/CallsIntegrationTests.cs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class CallsSmokeTests : IDisposable
1616
{
1717
private string accountId;
1818
private CreateCall createCallBody;
19-
private Configuration fakeConfiguration;
19+
private Configuration configuration;
2020
private UpdateCall fakeUpdateCall;
2121
private CallsApi forbiddenInstance;
2222
private CallsApi instance;
@@ -31,21 +31,21 @@ public CallsSmokeTests()
3131
testCallId = "testCallId";
3232

3333
// Authorized API Client
34-
fakeConfiguration = new Configuration();
35-
fakeConfiguration.BasePath = "https://voice.bandwidth.com/api/v2";
36-
fakeConfiguration.Username = Environment.GetEnvironmentVariable("BW_USERNAME");
37-
fakeConfiguration.Password = Environment.GetEnvironmentVariable("BW_PASSWORD");
38-
instance = new CallsApi(fakeConfiguration);
34+
configuration = new Configuration();
35+
configuration.BasePath = "https://voice.bandwidth.com/api/v2";
36+
configuration.OAuthClientId = Environment.GetEnvironmentVariable("BW_CLIENT_ID");
37+
configuration.OAuthClientSecret = Environment.GetEnvironmentVariable("BW_CLIENT_SECRET");
38+
instance = new CallsApi(configuration);
3939

4040
// Unauthorized API Client
41-
fakeConfiguration.Username = "badUsername";
42-
fakeConfiguration.Password = "badPassword";
43-
unauthorizedInstance = new CallsApi(fakeConfiguration);
41+
configuration.Username = "badUsername";
42+
configuration.Password = "badPassword";
43+
unauthorizedInstance = new CallsApi(configuration);
4444

4545
// Forbidden API Client
46-
fakeConfiguration.Username = Environment.GetEnvironmentVariable("BW_USERNAME_FORBIDDEN");
47-
fakeConfiguration.Password = Environment.GetEnvironmentVariable("BW_PASSWORD_FORBIDDEN");
48-
forbiddenInstance = new CallsApi(fakeConfiguration);
46+
configuration.Username = Environment.GetEnvironmentVariable("BW_USERNAME_FORBIDDEN");
47+
configuration.Password = Environment.GetEnvironmentVariable("BW_PASSWORD_FORBIDDEN");
48+
forbiddenInstance = new CallsApi(configuration);
4949

5050
createCallBody = new CreateCall(
5151
to: Environment.GetEnvironmentVariable("USER_NUMBER"),
@@ -114,9 +114,9 @@ public void Dispose()
114114
/// <summary>
115115
/// Test successful CreateCall request
116116
/// </summary>
117-
[Fact]
117+
[Fact]
118118
public void CreateCallTest()
119-
{
119+
{
120120
ApiResponse<CreateCallResponse> response = instance.CreateCallWithHttpInfo(accountId, createCallBody);
121121
Assert.Equal(HttpStatusCode.Created, response.StatusCode);
122122
Assert.IsType<string>(response.Data.CallId);
@@ -227,7 +227,7 @@ public void ListCallsUnauthorizedRequest()
227227
{
228228
ApiException Exception = Assert.Throws<ApiException>(() => unauthorizedInstance.ListCallsWithHttpInfo(accountId));
229229
Assert.Equal(401, Exception.ErrorCode);
230-
}
230+
}
231231

232232
/// <summary>
233233
/// Test ListCalls with a forbidden client
@@ -262,12 +262,12 @@ public void UpdateCallTest()
262262
);
263263

264264
System.Threading.Thread.Sleep(testSleep);
265-
265+
266266
ApiResponse<Object> response = instance.UpdateCallWithHttpInfo(accountId, callId, updateCallBody);
267267
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
268268

269269
System.Threading.Thread.Sleep(testSleep);
270-
270+
271271
//Hanging up the call
272272
updateCallBody.State = CallStateEnum.Completed;
273273
response = instance.UpdateCallWithHttpInfo(accountId, callId, updateCallBody);
@@ -284,7 +284,7 @@ public void UpdateCallBadRequest()
284284
string callId = createCallResponse.CallId;
285285

286286
System.Threading.Thread.Sleep(testSleep);
287-
287+
288288
fakeUpdateCall.State = null;
289289
ApiException Exception = Assert.Throws<ApiException>(() => instance.UpdateCall(accountId, callId, fakeUpdateCall));
290290
Assert.Equal(400, Exception.ErrorCode);
@@ -314,9 +314,9 @@ public void UpdateCallForbiddenRequest()
314314
{
315315
CreateCallResponse createCallResponse = instance.CreateCall(accountId, mantecaCallBody);
316316
string callId = createCallResponse.CallId;
317-
317+
318318
System.Threading.Thread.Sleep(testSleep);
319-
319+
320320
fakeUpdateCall.State = CallStateEnum.Completed;
321321
ApiException Exception = Assert.Throws<ApiException>(() => forbiddenInstance.UpdateCall(accountId, callId, fakeUpdateCall));
322322
Assert.Equal(403, Exception.ErrorCode);
@@ -346,7 +346,7 @@ public void UpdateCallBxml()
346346
{
347347
CreateCallResponse createCallResponse = instance.CreateCall(accountId, mantecaCallBody);
348348
string callId = createCallResponse.CallId;
349-
349+
350350
System.Threading.Thread.Sleep(testSleep);
351351

352352
ApiResponse<Object> updateCallBxmlResponse = instance.UpdateCallBxmlWithHttpInfo(accountId, callId, "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Bxml> <SpeakSentence>This is a test sentence.</SpeakSentence></Bxml>");
@@ -368,7 +368,7 @@ public void UpdateCallBxmlBadRequest()
368368
{
369369
ApiResponse<CreateCallResponse> createCallResponse = instance.CreateCallWithHttpInfo(accountId, mantecaCallBody);
370370
string callId = createCallResponse.Data.CallId;
371-
371+
372372
System.Threading.Thread.Sleep(testSleep);
373373

374374
ApiException Exception = Assert.Throws<ApiException>(() => instance.UpdateCallBxmlWithHttpInfo(accountId, callId, "invalid BXML"));
@@ -400,7 +400,7 @@ public void UpdateCallBxmlForbiddenRequest()
400400
{
401401
CreateCallResponse createCallResponse = instance.CreateCall(accountId, mantecaCallBody);
402402
string callId = createCallResponse.CallId;
403-
403+
404404
System.Threading.Thread.Sleep(testSleep);
405405

406406
ApiException Exception = Assert.Throws<ApiException>(() => forbiddenInstance.UpdateCallBxmlWithHttpInfo(accountId, callId, "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Bxml> <SpeakSentence>This is a test sentence.</SpeakSentence></Bxml>"));

src/Bandwidth.Standard.Test/Smoke/ConferencesIntegrationTests.cs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class ConferencesSmokeTests : IDisposable
2121
private ApiClient restClient;
2222
private UpdateConference updateConferenceBody;
2323
private CallsApi callsApiInstance;
24-
private Configuration fakeConfiguration;
24+
private Configuration configuration;
2525
private CreateCall mantecaCallBody;
2626
private UpdateConferenceMember updateConferenceMember;
2727
private string accountId;
@@ -39,24 +39,24 @@ public ConferencesSmokeTests()
3939
testUpdateBxml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Bxml><SpeakSentence locale=\"en_US\" gender=\"female\" voice=\"susan\">This is test BXML.</SpeakSentence></Bxml>";
4040

4141
// Authorized API Client
42-
fakeConfiguration = new Configuration();
43-
fakeConfiguration.BasePath = "https://voice.bandwidth.com/api/v2";
44-
fakeConfiguration.Username = Environment.GetEnvironmentVariable("BW_USERNAME");
45-
fakeConfiguration.Password = Environment.GetEnvironmentVariable("BW_PASSWORD");
46-
conferenceApiInstance = new ConferencesApi(fakeConfiguration);
47-
callsApiInstance = new CallsApi(fakeConfiguration);
42+
configuration = new Configuration();
43+
configuration.BasePath = "https://voice.bandwidth.com/api/v2";
44+
configuration.OAuthClientId = Environment.GetEnvironmentVariable("BW_CLIENT_ID");
45+
configuration.OAuthClientSecret = Environment.GetEnvironmentVariable("BW_CLIENT_SECRET");
46+
conferenceApiInstance = new ConferencesApi(configuration);
47+
callsApiInstance = new CallsApi(configuration);
4848

4949
// Unauthorized API Client
50-
fakeConfiguration.Username = "badUsername";
51-
fakeConfiguration.Password = "badPassword";
52-
unauthorizedInstance = new ConferencesApi(fakeConfiguration);
50+
configuration.Username = "badUsername";
51+
configuration.Password = "badPassword";
52+
unauthorizedInstance = new ConferencesApi(configuration);
5353

5454
// Forbidden API Client
55-
fakeConfiguration.Username = Environment.GetEnvironmentVariable("BW_USERNAME_FORBIDDEN");
56-
fakeConfiguration.Password = Environment.GetEnvironmentVariable("BW_PASSWORD_FORBIDDEN");
57-
forbiddenInstance = new ConferencesApi(fakeConfiguration);
55+
configuration.Username = Environment.GetEnvironmentVariable("BW_USERNAME_FORBIDDEN");
56+
configuration.Password = Environment.GetEnvironmentVariable("BW_PASSWORD_FORBIDDEN");
57+
forbiddenInstance = new ConferencesApi(configuration);
5858

59-
restClient = new ApiClient(basePath: "https://voice.bandwidth.com/api/v2");
59+
restClient = new ApiClient(basePath: "https://voice.bandwidth.com/api/v2");
6060

6161
updateConferenceBody = new UpdateConference(
6262
status: ConferenceStateEnum.Active,
@@ -159,7 +159,7 @@ public Tuple<string, string> CreateConferenceTest()
159159
/// <returns>
160160
/// A string containing the status of the test requested.
161161
/// </returns>
162-
162+
163163
public string GetTestStatus(string testId)
164164
{
165165
var options = new RequestOptions
@@ -175,7 +175,7 @@ public string GetTestStatus(string testId)
175175
path: Environment.GetEnvironmentVariable("MANTECA_BASE_URL") + "/tests/" + testId,
176176
options: options
177177
);
178-
178+
179179
return response.Content.ToString();
180180
}
181181

@@ -185,7 +185,7 @@ public string GetTestStatus(string testId)
185185
[Fact]
186186
public void testConferenceAndMembers()
187187
{
188-
Tuple <string, string> createCoferenceResponse = CreateConferenceTest();
188+
Tuple<string, string> createCoferenceResponse = CreateConferenceTest();
189189
var testId = createCoferenceResponse.Item1;
190190
var conferenceId = createCoferenceResponse.Item2;
191191

@@ -198,7 +198,7 @@ public void testConferenceAndMembers()
198198
Assert.Equal(HttpStatusCode.OK, getConferenceResponse.StatusCode);
199199
Assert.Equal(conferenceId, getConferenceResponse.Data.Id);
200200
Assert.IsType<string>(getConferenceResponse.Data.Name);
201-
201+
202202
var callId = getConferenceResponse.Data.ActiveMembers[0].CallId;
203203

204204
var GetConferenceMemberResponse = conferenceApiInstance.GetConferenceMemberWithHttpInfo(accountId, conferenceId, callId);
@@ -222,16 +222,16 @@ public void testConferenceAndMembers()
222222
);
223223
// hang up call
224224
callsApiInstance.UpdateCall(accountId, callId, updateCall);
225-
}
225+
}
226226

227227
/// <summary>
228228
/// Test Conference Recordings
229229
/// Tests a successful flow of creating a call with a recording.
230230
/// </summary>
231-
[Fact (Skip = "PV Issue")]
231+
[Fact(Skip = "PV Issue")]
232232
public void testConferenceRecordings()
233233
{
234-
Tuple <string, string> createCoferenceResponse = CreateConferenceTest();
234+
Tuple<string, string> createCoferenceResponse = CreateConferenceTest();
235235
var testId = createCoferenceResponse.Item1;
236236
var conferenceId = createCoferenceResponse.Item2;
237237
var listConferencesResponse = conferenceApiInstance.ListConferencesWithHttpInfo(accountId);
@@ -274,7 +274,7 @@ public void testConferenceRecordings()
274274

275275
var recordingMediaResponse = conferenceApiInstance.DownloadConferenceRecordingWithHttpInfo(accountId, conferenceId, firstRecordingId);
276276
Assert.Equal(HttpStatusCode.OK, recordingMediaResponse.StatusCode);
277-
}
277+
}
278278

279279
/// <summary>
280280
/// Test List Conferences Unauthorized
@@ -403,7 +403,7 @@ public void GetConferenceRecordingForbiddenRequest()
403403
public void GetConferenceRecordingNotFound()
404404
{
405405
ApiException exception = Assert.Throws<ApiException>(() => conferenceApiInstance.GetConferenceRecordingWithHttpInfo(accountId, testConferenceId, testRecordingId));
406-
Assert.Equal(404, exception.ErrorCode);
406+
Assert.Equal(404, exception.ErrorCode);
407407
}
408408

409409
/// <summary>
@@ -429,7 +429,7 @@ public void UpdateConferenceForbiddenRequest()
429429
/// <summary>
430430
/// Test Update Conference Not Found
431431
/// </summary>
432-
[Fact (Skip = "PV Issue")]
432+
[Fact(Skip = "PV Issue")]
433433
public void UpdateConferenceNotFoundRequest()
434434
{
435435
ApiException exception = Assert.Throws<ApiException>(() => conferenceApiInstance.UpdateConferenceWithHttpInfo(accountId, testConferenceId, updateConferenceBody));
@@ -460,7 +460,7 @@ public void UpdateConferenceBxmlForbiddenRequest()
460460
/// <summary>
461461
/// Test Update Conference BXML Not Found
462462
/// </summary>
463-
[Fact (Skip = "PV Issue")]
463+
[Fact(Skip = "PV Issue")]
464464
public void UpdateConferenceBxmlNotFoundRequest()
465465
{
466466
ApiException exception = Assert.Throws<ApiException>(() => conferenceApiInstance.UpdateConferenceBxmlWithHttpInfo(accountId, testConferenceId, testUpdateBxml));
@@ -490,7 +490,7 @@ public void UpdateConferenceMemberForbiddenRequest()
490490
/// <summary>
491491
/// Test Update Conference Member Not Found
492492
/// </summary>
493-
[Fact (Skip = "PV Issue")]
493+
[Fact(Skip = "PV Issue")]
494494
public void UpdateConferenceMemberNotFoundRequest()
495495
{
496496
ApiException exception = Assert.Throws<ApiException>(() => conferenceApiInstance.UpdateConferenceMember(accountId, testConferenceId, testMemberId, updateConferenceMember));

src/Bandwidth.Standard.Test/Smoke/MFAIntegrationTests.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class MFASmokeTests : IDisposable
1818
private string accountId;
1919
private CodeRequest badCodeRequest;
2020
private string BW_NUMBER;
21-
private Configuration fakeConfiguration;
21+
private Configuration configuration;
2222
private MFAApi forbiddenInstance;
2323
private MFAApi instance;
2424
private CodeRequest messagingCodeRequest;
@@ -34,19 +34,19 @@ public MFASmokeTests()
3434
USER_NUMBER = Environment.GetEnvironmentVariable("USER_NUMBER");
3535

3636
// Authorized API Client
37-
fakeConfiguration = new Configuration();
38-
fakeConfiguration.BasePath = "https://mfa.bandwidth.com/api/v1";
39-
fakeConfiguration.Username = Environment.GetEnvironmentVariable("BW_USERNAME");
40-
fakeConfiguration.Password = Environment.GetEnvironmentVariable("BW_PASSWORD");
41-
instance = new MFAApi(fakeConfiguration);
37+
configuration = new Configuration();
38+
configuration.BasePath = "https://mfa.bandwidth.com/api/v1";
39+
configuration.Username = Environment.GetEnvironmentVariable("BW_USERNAME");
40+
configuration.Password = Environment.GetEnvironmentVariable("BW_PASSWORD");
41+
instance = new MFAApi(configuration);
4242

4343
// Unauthorized API Client
4444
unauthorizedInstance = new MFAApi();
4545

4646
// Forbidden API Client
47-
fakeConfiguration.Username = Environment.GetEnvironmentVariable("BW_USERNAME_FORBIDDEN");
48-
fakeConfiguration.Password = "badPassword";
49-
forbiddenInstance = new MFAApi(fakeConfiguration);
47+
configuration.Username = Environment.GetEnvironmentVariable("BW_USERNAME_FORBIDDEN");
48+
configuration.Password = "badPassword";
49+
forbiddenInstance = new MFAApi(configuration);
5050

5151
// Code Request for generating a messaging code
5252
messagingCodeRequest = new CodeRequest(
@@ -129,7 +129,7 @@ public void GenerateMessagingCodeBadRequest()
129129
public void GenerateMessagingCodeUnauthorizedRequest()
130130
{
131131
ApiException Exception = Assert.Throws<ApiException>(() => unauthorizedInstance.GenerateMessagingCode(accountId, messagingCodeRequest));
132-
Assert.Equal(401, Exception.ErrorCode);
132+
Assert.Equal(401, Exception.ErrorCode);
133133
}
134134

135135
/// <summary>
@@ -170,7 +170,7 @@ public void GenerateVoiceCodeBadRequest()
170170
public void GenerateVoiceCodeUnauthorizedRequest()
171171
{
172172
ApiException Exception = Assert.Throws<ApiException>(() => unauthorizedInstance.GenerateVoiceCode(accountId, voiceCodeRequest));
173-
Assert.Equal(401, Exception.ErrorCode);
173+
Assert.Equal(401, Exception.ErrorCode);
174174
}
175175

176176
/// <summary>
@@ -190,7 +190,7 @@ public void GenerateVoiceCodeForbiddenRequest()
190190
[Fact]
191191
public void VerifyCodeTest()
192192
{
193-
for(int i = 0; i < 10; i++)
193+
for (int i = 0; i < 10; i++)
194194
{
195195
verifyCodeRequest.To = verifyCodeRequest.To + new Random().Next(10).ToString();
196196
}
@@ -229,7 +229,7 @@ public void VerifyCodeForbiddenRequest()
229229
[Fact]
230230
public void VerifyCodeRateLimiting()
231231
{
232-
for(int i = 0; i < 10; i++)
232+
for (int i = 0; i < 10; i++)
233233
{
234234
verifyCodeRequest.To = verifyCodeRequest.To + new Random().Next(10).ToString();
235235
}

0 commit comments

Comments
 (0)