-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate test project into integration and unit test project
- Loading branch information
1 parent
9fbde8f
commit 5d66d70
Showing
11 changed files
with
195 additions
and
31 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/AssemblyAI.IntegrationTests/AssemblyAI.IntegrationTests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="coverlet.collector" Version="6.0.0"/> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/> | ||
<PackageReference Include="NUnit" Version="3.14.0"/> | ||
<PackageReference Include="NUnit.Analyzers" Version="3.9.0"/> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Using Include="NUnit.Framework"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\AssemblyAI\AssemblyAI.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="TestData\*"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
</Project> |
4 changes: 1 addition & 3 deletions
4
src/AssemblyAI.Test/FilesClientTests.cs → ...lyAI.IntegrationTests/FilesClientTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
namespace AssemblyAI.IntegrationTests; | ||
|
||
[TestFixture] | ||
public class LemurTests | ||
{ | ||
private string ApiKey | ||
{ | ||
get | ||
{ | ||
var apiKey = TestContext.Parameters.Get("ASSEMBLYAI_API_KEY"); | ||
if (string.IsNullOrEmpty(apiKey)) | ||
throw new Exception("ASSEMBLYAI_API_KEY .runsettings parameter is not set."); | ||
return apiKey; | ||
} | ||
} | ||
|
||
private string[] TranscriptIds | ||
{ | ||
get | ||
{ | ||
var transcriptIds = TestContext.Parameters.Get("TEST_TRANSCRIPT_IDS"); | ||
if (string.IsNullOrEmpty(transcriptIds)) | ||
throw new Exception("TEST_TRANSCRIPT_IDS .runsettings parameter is not set."); | ||
return transcriptIds.Split(','); | ||
} | ||
} | ||
|
||
// TODO: uncomment when Fern fixes params generation | ||
/*[Test] | ||
public async Task Should_Generate_Summary() | ||
{ | ||
var client = new AssemblyAIClient(ApiKey); | ||
var response = await client.Lemur.SummaryAsync(new LemurSummaryParams | ||
{ | ||
FinalModel = LemurModel.Basic, | ||
TranscriptIds = TranscriptIds, | ||
AnswerFormat = "one sentence" | ||
}).ConfigureAwait(false); | ||
Assert.That(response, Is.Not.Null); | ||
Assert.That(response.RequestId, Is.Not.Empty); | ||
Assert.That(response.Response, Is.Not.Empty); | ||
} | ||
[Test] | ||
public async Task Should_Generate_Answer() | ||
{ | ||
var client = new AssemblyAIClient(ApiKey); | ||
var response = await client.Lemur.QuestionAnswerAsync(new LemurQuestionAnswerParams | ||
{ | ||
FinalModel = LemurModel.Basic, | ||
TranscriptIds = TranscriptIds, | ||
Questions = new[] | ||
{ | ||
new LemurQuestion | ||
{ | ||
Question = "What are they discussing?", | ||
AnswerFormat = "text" | ||
} | ||
} | ||
}).ConfigureAwait(false); | ||
Assert.That(response, Is.Not.Null); | ||
Assert.That(response.RequestId, Is.Not.Empty); | ||
Assert.That(response.Response, Is.Not.Empty); | ||
Assert.That(response.Response.First().Question, Is.Not.Empty); | ||
Assert.That(response.Response.First().Answer, Is.Not.Empty); | ||
} | ||
[Test] | ||
public async Task Should_Generate_Action_Items() | ||
{ | ||
var client = new AssemblyAIClient(ApiKey); | ||
var response = await client.Lemur.ActionItemsAsync(new LemurActionItemsParams() | ||
{ | ||
FinalModel = LemurModel.Basic, | ||
TranscriptIds = TranscriptIds | ||
}).ConfigureAwait(false); | ||
Assert.That(response, Is.Not.Null); | ||
Assert.That(response.RequestId, Is.Not.Empty); | ||
Assert.That(response.Response, Is.Not.Empty); | ||
} | ||
[Test] | ||
public async Task Should_Generate_Task() | ||
{ | ||
var client = new AssemblyAIClient(ApiKey); | ||
var response = await client.Lemur.TaskAsync(new LemurTaskParams | ||
{ | ||
FinalModel = LemurModel.Basic, | ||
TranscriptIds = TranscriptIds, | ||
Prompt = "Write a haiku about this conversation." | ||
}).ConfigureAwait(false); | ||
Assert.That(response, Is.Not.Null); | ||
Assert.That(response.RequestId, Is.Not.Empty); | ||
Assert.That(response.Response, Is.Not.Empty); | ||
} | ||
[Test] | ||
public void Should_Fail_To_Generate_Summary() | ||
{ | ||
var client = new AssemblyAIClient(ApiKey); | ||
var ex = Assert.ThrowsAsync<Exception>(async () => await client.Lemur.SummaryAsync(new LemurSummaryParams | ||
{ | ||
FinalModel = LemurModel.Basic, | ||
TranscriptIds = ["bad-id"], | ||
AnswerFormat = "one sentence" | ||
}).ConfigureAwait(false)); | ||
Assert.That(ex.Message, Is.EqualTo("each transcript source id must be valid")); | ||
} | ||
[Test] | ||
public async Task Should_Return_Response() | ||
{ | ||
var client = new AssemblyAIClient(ApiKey); | ||
var taskResponse = await client.Lemur.TaskAsync(new LemurTaskParams | ||
{ | ||
FinalModel = LemurModel.Basic, | ||
TranscriptIds = TranscriptIds, | ||
Prompt = "Write a haiku about this conversation." | ||
}).ConfigureAwait(false); | ||
var taskResponse2OneOf = await client.Lemur.GetResponseAsync(taskResponse.RequestId).ConfigureAwait(false); | ||
var taskResponse2 = (LemurStringResponse) taskResponse2OneOf.Value; | ||
Assert.That(taskResponse2.RequestId, Is.EqualTo(taskResponse.RequestId)); | ||
Assert.That(taskResponse2.Response, Is.EqualTo(taskResponse.Response)); | ||
} | ||
[Test] | ||
public async Task Should_Purge_Request_Data() | ||
{ | ||
var client = new AssemblyAIClient(ApiKey); | ||
var summaryResponse = await client.Lemur.SummaryAsync(new LemurSummaryParams | ||
{ | ||
FinalModel = LemurModel.Basic, | ||
TranscriptIds = TranscriptIds, | ||
AnswerFormat = "one sentence" | ||
}).ConfigureAwait(false); | ||
var deletionRequest = await client.Lemur.PurgeRequestDataAsync(summaryResponse.RequestId).ConfigureAwait(false); | ||
Assert.That(deletionRequest.Deleted, Is.True); | ||
Assert.That(summaryResponse.RequestId, Is.EqualTo(deletionRequest.RequestIdToPurge)); | ||
}*/ | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
src/AssemblyAI.Test/DiClientOptionsTests.cs → ...semblyAI.UnitTest/DiClientOptionsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
src/AssemblyAI.Test/DiClientTests.cs → src/AssemblyAI.UnitTest/DiClientTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/AssemblyAI.Test/UserAgentTests.cs → src/AssemblyAI.UnitTest/UserAgentTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters