Skip to content

Commit

Permalink
SWI-1632: General reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
juliajanu committed Oct 10, 2023
1 parent 7d9479d commit 89d8d1c
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ public class CallsIntegrationTests : IDisposable
private int testSleep;
private CallsApi unauthorizedInstance;
public CallsIntegrationTests()
{
// Test Constants
{
accountId = Environment.GetEnvironmentVariable("BW_ACCOUNT_ID");
testSleep = 5000;
testCallId = "testCallId";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public class ConferencesIntegrationTests : IDisposable
public ConferencesIntegrationTests()
{
accountId = Environment.GetEnvironmentVariable("BW_ACCOUNT_ID");
testConferenceId = "Conf-Id";
testMemberId = "Member-Id";
testRecordingId = "Recording-Id";
testUpdateBxml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Bxml><SpeakSentence locale=\"en_US\" gender=\"female\" voice=\"susan\">This is test BXML.</SpeakSentence></Bxml>";

// Authorized API Client
fakeConfiguration = new Configuration();
Expand All @@ -52,7 +56,6 @@ public ConferencesIntegrationTests()
fakeConfiguration.Password = Environment.GetEnvironmentVariable("BW_PASSWORD_FORBIDDEN");
forbiddenInstance = new ConferencesApi(fakeConfiguration);


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

updateConferenceBody = new UpdateConference(
Expand All @@ -75,10 +78,6 @@ public ConferencesIntegrationTests()
);

updateConferenceMember = new UpdateConferenceMember(mute: false);
testConferenceId = "Conf-Id";
testMemberId = "Member-Id";
testRecordingId = "Recording-Id";
testUpdateBxml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Bxml><SpeakSentence locale=\"en_US\" gender=\"female\" voice=\"susan\">This is test BXML.</SpeakSentence></Bxml>";
}

public void Dispose()
Expand Down
16 changes: 10 additions & 6 deletions src/Bandwidth.Standard.Test/Integration/MFAIntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,21 @@ public class MFAIntegrationTests : IDisposable
{
private string accountId;
private CodeRequest badCodeRequest;
private string BW_NUMBER;
private Configuration fakeConfiguration;
private MFAApi forbiddenInstance;
private MFAApi instance;
private CodeRequest messagingCodeRequest;
private MFAApi unauthorizedInstance;
private string USER_NUMBER;
private VerifyCodeRequest verifyCodeRequest;
private CodeRequest voiceCodeRequest;

public MFAIntegrationTests()
{
accountId = Environment.GetEnvironmentVariable("BW_ACCOUNT_ID");
BW_NUMBER = Environment.GetEnvironmentVariable("BW_NUMBER");
USER_NUMBER = Environment.GetEnvironmentVariable("USER_NUMBER");

// Authorized API Client
fakeConfiguration = new Configuration();
Expand All @@ -46,8 +50,8 @@ public MFAIntegrationTests()

// Code Request for generating a messaging code
messagingCodeRequest = new CodeRequest(
to: Environment.GetEnvironmentVariable("USER_NUMBER"),
from: Environment.GetEnvironmentVariable("BW_NUMBER"),
to: USER_NUMBER,
from: BW_NUMBER,
applicationId: Environment.GetEnvironmentVariable("BW_MESSAGING_APPLICATION_ID"),
message: "Your temporary {NAME} {SCOPE} code is {CODE}",
scope: "2FA",
Expand All @@ -56,8 +60,8 @@ public MFAIntegrationTests()

// Code Request for generating a voice code
voiceCodeRequest = new CodeRequest(
to: Environment.GetEnvironmentVariable("USER_NUMBER"),
from: Environment.GetEnvironmentVariable("BW_NUMBER"),
to: USER_NUMBER,
from: BW_NUMBER,
applicationId: Environment.GetEnvironmentVariable("BW_VOICE_APPLICATION_ID"),
message: "Your temporary {NAME} {SCOPE} code is {CODE}",
scope: "2FA",
Expand All @@ -66,8 +70,8 @@ public MFAIntegrationTests()

// Bad Code Request
badCodeRequest = new CodeRequest(
to: Environment.GetEnvironmentVariable("USER_NUMBER"),
from: Environment.GetEnvironmentVariable("BW_NUMBER"),
to: USER_NUMBER,
from: BW_NUMBER,
applicationId: "not an application id",
message: "Your temporary {NAME} {SCOPE} code is {CODE}",
scope: "2FA",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public MediaIntegrationTests()
accountId = Environment.GetEnvironmentVariable("BW_ACCOUNT_ID");
testContentType = "image/jpeg";
testMediaId = $"test-media-id-{Guid.NewGuid()}";

// Authorized API Client
fakeConfiguration = new Configuration();
fakeConfiguration.BasePath = "https://voice.bandwidth.com/api/v2";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace Bandwidth.Standard.Test.Integration
public class PhoneNumberLookupIntegrationTests : IDisposable
{
private string accountId;
private string BW_NUMBER;
private Configuration fakeConfiguration;
private PhoneNumberLookupApi forbiddenInstance;
private PhoneNumberLookupApi instance;
Expand All @@ -25,6 +26,7 @@ public PhoneNumberLookupIntegrationTests()
{
accountId = Environment.GetEnvironmentVariable("BW_ACCOUNT_ID");
testRequestId = "test-request-id";
BW_NUMBER = Environment.GetEnvironmentVariable("BW_NUMBER");

// Authorized API Client
fakeConfiguration = new Configuration();
Expand Down Expand Up @@ -64,13 +66,13 @@ public void InstanceTest()
[Fact]
public void GetLookupStatusTest()
{
LookupRequest lookupRequest = new LookupRequest(new List<string> { Environment.GetEnvironmentVariable("BW_NUMBER") });
LookupRequest lookupRequest = new LookupRequest(new List<string> { BW_NUMBER });
var response = instance.CreateLookupWithHttpInfo(accountId, lookupRequest);

var lookupStatus = instance.GetLookupStatus(accountId, response.Data.RequestId);
Assert.IsType<LookupStatus>(lookupStatus);
Assert.Equal(response.Data.RequestId, lookupStatus.RequestId);
Assert.Equal(Environment.GetEnvironmentVariable("BW_NUMBER"), lookupStatus.Result[0].E164Format);
Assert.Equal(BW_NUMBER, lookupStatus.Result[0].E164Format);
}

/// <summary>
Expand Down Expand Up @@ -101,7 +103,7 @@ public void GetLookupStatusForbiddenRequest()
[Fact]
public void CreateLookupTest()
{
LookupRequest lookupRequest = new LookupRequest(new List<string> { Environment.GetEnvironmentVariable("BW_NUMBER") });
LookupRequest lookupRequest = new LookupRequest(new List<string> { BW_NUMBER });
var response = instance.CreateLookupWithHttpInfo(accountId, lookupRequest);
Assert.IsType<ApiResponse<CreateLookupResponse>>(response);
Assert.Equal(LookupStatusEnum.INPROGRESS, response.Data.Status);
Expand All @@ -112,7 +114,7 @@ public void CreateLookupTest()
var lookupStatus = instance.GetLookupStatus(accountId, response.Data.RequestId);
Assert.IsType<LookupStatus>(lookupStatus);
Assert.Equal(response.Data.RequestId, lookupStatus.RequestId);
Assert.Equal(Environment.GetEnvironmentVariable("BW_NUMBER"), lookupStatus.Result[0].E164Format);
Assert.Equal(BW_NUMBER, lookupStatus.Result[0].E164Format);

}

Expand All @@ -136,7 +138,7 @@ public void CreateLookupBadRequest()
[Fact]
public void CreateLookupDuplicateRequest()
{
LookupRequest lookupRequest = new LookupRequest(new List<string> { Environment.GetEnvironmentVariable("BW_NUMBER"), Environment.GetEnvironmentVariable("BW_NUMBER") });
LookupRequest lookupRequest = new LookupRequest(new List<string> { BW_NUMBER, BW_NUMBER });
ApiException Exception = Assert.Throws<ApiException>(() => instance.CreateLookup(accountId, lookupRequest));
Assert.Equal(400, Exception.ErrorCode);
Assert.IsType<string>(Exception.Message);
Expand All @@ -148,7 +150,7 @@ public void CreateLookupDuplicateRequest()
[Fact]
public void CreateLookupUnauthorizedRequest()
{
LookupRequest lookupRequest = new LookupRequest(new List<string> { Environment.GetEnvironmentVariable("BW_NUMBER") });
LookupRequest lookupRequest = new LookupRequest(new List<string> { BW_NUMBER });
ApiException Exception = Assert.Throws<ApiException>(() => unauthorizedInstance.CreateLookup(accountId, lookupRequest));
Assert.Equal(401, Exception.ErrorCode);
}
Expand All @@ -159,7 +161,7 @@ public void CreateLookupUnauthorizedRequest()
[Fact]
public void CreateLookupForbiddenRequest()
{
LookupRequest lookupRequest = new LookupRequest(new List<string> { Environment.GetEnvironmentVariable("BW_NUMBER") });
LookupRequest lookupRequest = new LookupRequest(new List<string> { BW_NUMBER });
ApiException Exception = Assert.Throws<ApiException>(() => forbiddenInstance.CreateLookup(accountId, lookupRequest));
//This API throws a 401 when a user provides valid credentials with the `TN Lookup` role disabled
// Assert.Equal(403, Exception.ErrorCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public class RecordingsIntegrationTests : IDisposable

public RecordingsIntegrationTests()
{
//Constants
accountId = Environment.GetEnvironmentVariable("BW_ACCOUNT_ID");
testCallId = "callId";
testRecordingId = "recordingId";
Expand Down

0 comments on commit 89d8d1c

Please sign in to comment.