Skip to content

Commit

Permalink
SWI-1632: [.NET] API Integration Tests (#75)
Browse files Browse the repository at this point in the history
* SWI-1632: Working on API integration tests

* SWI-1632: Finished integration tests

* SWI-1632: Added environment variables to workflows

* SWI-1632: Added forbidden user & pass to workflows

* SWI-1632: Added rate limit test

* SWI-1632: Updating request to number

* SWI-1632: Trying to get media tests to work

* SWI-1632: General reformatting
  • Loading branch information
juliajanu authored Oct 10, 2023
1 parent f56b867 commit 6d944fd
Show file tree
Hide file tree
Showing 12 changed files with 2,480 additions and 8 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,19 @@ jobs:
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
BW_USERNAME: ${{ secrets.BW_USERNAME }}
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN}}
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN}}
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}
BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }}
BW_NUMBER: ${{ secrets.BW_NUMBER }}
USER_NUMBER: ${{ secrets.USER_NUMBER }}
BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }}
MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }}
MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }}
MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }}
MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }}
OPERATING_SYSTEM: ${{ matrix.os }}
CSHARP_VERSION: ${{ matrix.dotnet }}
run: dotnet test $BW_PROJECT_TEST_NAME
- name: Pack NuGet package
run: dotnet pack --configuration Release $BW_PROJECT_NAME -p:PackageVersion=$RELEASE_VERSION
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,19 @@ jobs:
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
BW_USERNAME: ${{ secrets.BW_USERNAME }}
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN}}
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN}}
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}
BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }}
BW_NUMBER: ${{ secrets.BW_NUMBER }}
USER_NUMBER: ${{ secrets.USER_NUMBER }}
BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }}
MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }}
MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }}
MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }}
MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }}
OPERATING_SYSTEM: ${{ matrix.os }}
CSHARP_VERSION: ${{ matrix.dotnet }}
# Required for multiple target frameworks in the StandardTests project.
DOTNET: ${{ matrix.dotnet }}
run: dotnet test src/Bandwidth.Standard.Test
Expand Down
8 changes: 1 addition & 7 deletions src/Bandwidth.Standard.Test/Api/MFAApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@
*/

using System;
using System.IO;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using RestSharp;
using Xunit;

using Bandwidth.Standard.Client;
Expand Down Expand Up @@ -91,7 +85,7 @@ public void GenerateVoiceCodeTest()
var response = instance.GenerateVoiceCodeWithHttpInfo(accountId, codeRequest);

Assert.IsType<ApiResponse<VoiceCodeResponse>>(response);
Assert.Equal(HttpStatusCode.OK, apiResponse.StatusCode);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Bandwidth.Standard.Test/Api/StatisticsApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public StatisticsApiTests()
mockClient = new Mock<ISynchronousClient>();
mockAsynchronousClient = new Mock<IAsynchronousClient>();
fakeConfiguration = new Configuration();
fakeConfiguration.BasePath = "https://numbers.bandwidth.com/api/v1";
fakeConfiguration.BasePath = "https://voice.bandwidth.com/api/v2";
fakeConfiguration.Username = "username";
fakeConfiguration.Password = "password";
instance = new StatisticsApi(mockClient.Object, mockAsynchronousClient.Object, fakeConfiguration);
Expand Down
Loading

0 comments on commit 6d944fd

Please sign in to comment.