Skip to content

Commit

Permalink
Skip tests due to sandbox outage
Browse files Browse the repository at this point in the history
The tests for `TestAvailableLanguages`, `TestSearchSubtitle`, `TestDownloadSubtitle`, and `TestUploadSubtitle` are now skipped because the sandbox environment is down. Added comments to use a mock API and improve the test setup with NSubstitute.
  • Loading branch information
ivandrofly committed Nov 26, 2024
1 parent 8eb98d1 commit cdb93de
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions SubDBSharp.UnitTest/SubDBClient.Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,37 @@ public class UnitTest
{
private static readonly IResponseParser ReponseParser = new CsvResponseParser();

[Fact]
[Fact(Skip = "Sandbox is down")]
public async Task TestAvailableLanguages()
{
// NOTE: SINCE THE SANDBOX IS ALSO DOWN, USE MOCK API
// TODO:
// * Use NSubstitue to mock the http clien
var subDbClient = new SubDBClient(GetProductInfo(), ApiUrls.SubDBApiSandBoxUrl);
var response = await subDbClient.GetAvailableLanguagesAsync();
Assert.NotNull(response.Body);

var buffer = (byte[]) response.Body;
var buffer = (byte[])response.Body;
var body = Encoding.UTF8.GetString(buffer, 0, buffer.Length);
var availableLanguages = ReponseParser.ParseGetAvailablesLanguages(body);

Assert.True(availableLanguages.Count > 0);
}

[Fact]
[Fact(Skip = "Sandbox is down")]
public async Task TestSearchSubtitle()
{
var subDbClient = new SubDBClient(GetProductInfo(), ApiUrls.SubDBApiSandBoxUrl);
var response = await subDbClient.SearchSubtitleAsync("ffd8d4aa68033dc03d1c8ef373b9028c", false);
Assert.NotNull(response.Body);
var buffer = (byte[]) response.Body;
var buffer = (byte[])response.Body;
Assert.True(buffer.Length > 0);
var body = Encoding.UTF8.GetString(buffer, 0, buffer.Length);
var availableLanguages = ReponseParser.ParseGetAvailablesLanguages(body);
Assert.True(availableLanguages.Count > 0);
}

[Fact]
[Fact(Skip = "Sandbox is down")]
public async Task TestDownloadSubtitle()
{
var subDbClient = new SubDBClient(GetProductInfo(), ApiUrls.SubDBApiSandBoxUrl);
Expand All @@ -46,7 +49,7 @@ public async Task TestDownloadSubtitle()
Assert.True(response.StatusCode == System.Net.HttpStatusCode.OK);
}

[Fact]
[Fact(Skip = "Sandbox is down")]
public async Task TestUploadSubtitle()
{
var movie = "./Assets/dexter.mp4";
Expand Down

0 comments on commit cdb93de

Please sign in to comment.