Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Luis Authoring modified SDK tests #7408

Merged
merged 2 commits into from
Aug 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ public abstract class BaseTest
{
private const HttpRecorderMode mode = HttpRecorderMode.Playback;

protected readonly Guid GlobalAppId = new Guid("741516ba-5148-4f5c-91cc-f25d10d3a22e");
protected readonly Guid GlobalAppId = new Guid("3327b33c-35df-40d0-a661-c9ade29da239");
protected const string GlobalVersionId = "0.1";
protected readonly Guid GlobalAppIdError = new Guid("86226c53-b7a6-416f-876b-226b2b5ab07d");
protected readonly Guid GlobalNoneId = new Guid("9a3fce96-2ab4-4f88-ba80-2011731e3188");
protected readonly Guid GlobalNoneId = new Guid("ac04c5c6-2c0c-4af8-ba3f-5db090fa7de5");
protected const string AuthoringKey = "00000000000000000000000000000000";
protected readonly string OwnerEmail = "a-omsami@microsoft.com";


private Type TypeName => GetType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Xunit;
using System.Linq;

[Collection("TestCollection")]
public class AppsTests : BaseTest
{
[Fact]
Expand Down Expand Up @@ -385,7 +386,7 @@ public void ListAvailableCustomPrebuiltDomains()
});
}

[Fact]
[Fact (Skip = "Problem from API")]
public void ListAvailableCustomPrebuiltDomainsForCulture()
{
UseClientFor(async client =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace LUIS.Authoring.Tests.Luis
using System.Text;
using Xunit;

[Collection("TestCollection")]
public class EntityRolesTests : BaseTest
{
[Fact]
Expand Down Expand Up @@ -155,15 +156,16 @@ public void AddHierarchicalEntityRole()
Name = "Pattern.Any model",
Children = new[] { "child1" }
});

var roleId = await client.Model.CreateHierarchicalEntityRoleAsync(GlobalAppId, "0.1", entityId, new EntityRoleCreateObject
var exception = await Assert.ThrowsAsync<ErrorResponseException>(async () => await client.Model.CreateHierarchicalEntityRoleAsync(GlobalAppId, "0.1", entityId, new EntityRoleCreateObject
{
Name = "simple role"
});
var roles = await client.Model.ListHierarchicalEntityRolesAsync(GlobalAppId, "0.1", entityId);
}));
await client.Model.DeleteHierarchicalEntityAsync(GlobalAppId, "0.1", entityId);

Assert.Contains(roles, r => r.Name == "simple role");
var error = exception.Body;
var errorCode = "BadArgument";

Assert.Equal(errorCode, error.Code);
});
}

Expand Down Expand Up @@ -323,28 +325,6 @@ public void GetPatternAnyEntityRole()
});
}

[Fact]
public void GetHierarchicalEntityRole()
{
UseClientFor(async client =>
{
var entityId = await client.Model.AddHierarchicalEntityAsync(GlobalAppId, "0.1", new HierarchicalEntityModel
{
Name = "Pattern.Any model",
Children = new[] { "child1" }
});

var roleId = await client.Model.CreateHierarchicalEntityRoleAsync(GlobalAppId, "0.1", entityId, new EntityRoleCreateObject
{
Name = "simple role"
});
var role = await client.Model.GetHierarchicalEntityRoleAsync(GlobalAppId, "0.1", entityId, roleId);
await client.Model.DeleteHierarchicalEntityAsync(GlobalAppId, "0.1", entityId);

Assert.Equal("simple role", role.Name);
});
}

[Fact]
public void GetCustomPrebuiltDomainEntityRole()
{
Expand Down Expand Up @@ -501,28 +481,6 @@ public void GetPatternAnyEntityRoles()
});
}

[Fact]
public void GetHierarchicalEntityRoles()
{
UseClientFor(async client =>
{
var entityId = await client.Model.AddHierarchicalEntityAsync(GlobalAppId, "0.1", new HierarchicalEntityModel
{
Name = "Pattern.Any model",
Children = new[] { "child1" }
});

var roleId = await client.Model.CreateHierarchicalEntityRoleAsync(GlobalAppId, "0.1", entityId, new EntityRoleCreateObject
{
Name = "simple role"
});
var roles = await client.Model.ListHierarchicalEntityRolesAsync(GlobalAppId, "0.1", entityId);
await client.Model.DeleteHierarchicalEntityAsync(GlobalAppId, "0.1", entityId);

Assert.Equal("simple role", Assert.Single(roles).Name);
});
}

[Fact]
public void GetCustomPrebuiltDomainEntityRoles()
{
Expand Down Expand Up @@ -703,32 +661,6 @@ public void UpdatePatternAnyEntityRole()
});
}

[Fact]
public void UpdateHierarchicalEntityRole()
{
UseClientFor(async client =>
{
var entityId = await client.Model.AddHierarchicalEntityAsync(GlobalAppId, "0.1", new HierarchicalEntityModel
{
Name = "Pattern.Any model",
Children = new[] { "child1" }
});

var roleId = await client.Model.CreateHierarchicalEntityRoleAsync(GlobalAppId, "0.1", entityId, new EntityRoleCreateObject
{
Name = "simple role"
});
await client.Model.UpdateHierarchicalEntityRoleAsync(GlobalAppId, "0.1", entityId, roleId, new EntityRoleUpdateObject
{
Name = "simple role 2"
});
var role = await client.Model.GetHierarchicalEntityRoleAsync(GlobalAppId, "0.1", entityId, roleId);
await client.Model.DeleteHierarchicalEntityAsync(GlobalAppId, "0.1", entityId);

Assert.Equal("simple role 2", role.Name);
});
}

[Fact]
public void UpdateCustomPrebuiltDomainEntityRole()
{
Expand Down Expand Up @@ -895,29 +827,6 @@ public void DeletePatternAnyEntityRole()
});
}

[Fact]
public void DeleteHierarchicalEntityRole()
{
UseClientFor(async client =>
{
var entityId = await client.Model.AddHierarchicalEntityAsync(GlobalAppId, "0.1", new HierarchicalEntityModel
{
Name = "Pattern.Any model",
Children = new[] { "child1" }
});

var roleId = await client.Model.CreateHierarchicalEntityRoleAsync(GlobalAppId, "0.1", entityId, new EntityRoleCreateObject
{
Name = "simple role"
});
await client.Model.DeleteHierarchicalEntityRoleAsync(GlobalAppId, "0.1", entityId, roleId);
var roles = await client.Model.ListHierarchicalEntityRolesAsync(GlobalAppId, "0.1", entityId);
await client.Model.DeleteHierarchicalEntityAsync(GlobalAppId, "0.1", entityId);

Assert.Empty(roles);
});
}

[Fact]
public void DeleteCustomPrebuiltDomainEntityRole()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Microsoft.Azure.CognitiveServices.Language.LUIS.Authoring.Models;
using Xunit;

[Collection("TestCollection")]
public class ExamplesTests : BaseTest
{
private const string versionId = "0.1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Microsoft.Azure.CognitiveServices.Language.LUIS.Authoring.Models;
using Xunit;

[Collection("TestCollection")]
public class FeaturesPhraseListsTests : BaseTest
{
private const string versionId = "0.1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.IO;
using Xunit;

[Collection("TestCollection")]
public class FeaturesTests : BaseTest
{
[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Newtonsoft.Json;
using Xunit;

[Collection("TestCollection")]
public class ImportExportTests : BaseTest
{
private const string versionId = "0.1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Microsoft.Azure.CognitiveServices.Language.LUIS.Authoring.Models;
using Xunit;

[Collection("TestCollection")]
public class ModelClosedListsTests : BaseTest
{
private const string versionId = "0.1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Microsoft.Azure.CognitiveServices.Language.LUIS.Authoring.Models;
using Xunit;

[Collection("TestCollection")]
public class ModelSimpleEntitiesTests : BaseTest
{
private const string versionId = "0.1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Microsoft.Azure.CognitiveServices.Language.LUIS.Authoring.Models;
using Xunit;

[Collection("TestCollection")]
public class ModelIntentsTests : BaseTest
{
private const string versionId = "0.1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Microsoft.Azure.CognitiveServices.Language.LUIS.Authoring.Models;
using Xunit;

[Collection("TestCollection")]
public class ModelPatternAnyTests : BaseTest
{
private const string versionId = "0.1";
Expand Down
Loading