Skip to content

Commit

Permalink
Block Media Theme Template Access
Browse files Browse the repository at this point in the history
  • Loading branch information
AydinE committed May 16, 2024
1 parent 155e72c commit 0271928
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 4 deletions.
15 changes: 15 additions & 0 deletions Lombiq.OSOCE.sln
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lombiq.HelpfulLibraries.Sou
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lombiq.HelpfulLibraries.Attributes", "src\Libraries\Lombiq.HelpfulLibraries\Lombiq.HelpfulLibraries.Attributes\Lombiq.HelpfulLibraries.Attributes.csproj", "{3B2C7634-1458-4FDF-9C12-8312A313F22F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lombiq.Hosting.MediaTheme.Bridge.Tests.UI", "src\Themes\Lombiq.Hosting.MediaTheme\Lombiq.Hosting.MediaTheme.Bridge.Tests.UI\Lombiq.Hosting.MediaTheme.Bridge.Tests.UI.csproj", "{3677F48D-591D-4701-86E9-8CB89C92EEAC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1370,6 +1372,18 @@ Global
{3B2C7634-1458-4FDF-9C12-8312A313F22F}.Release|x64.Build.0 = Release|Any CPU
{3B2C7634-1458-4FDF-9C12-8312A313F22F}.Release|x86.ActiveCfg = Release|Any CPU
{3B2C7634-1458-4FDF-9C12-8312A313F22F}.Release|x86.Build.0 = Release|Any CPU
{3677F48D-591D-4701-86E9-8CB89C92EEAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3677F48D-591D-4701-86E9-8CB89C92EEAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3677F48D-591D-4701-86E9-8CB89C92EEAC}.Debug|x64.ActiveCfg = Debug|Any CPU
{3677F48D-591D-4701-86E9-8CB89C92EEAC}.Debug|x64.Build.0 = Debug|Any CPU
{3677F48D-591D-4701-86E9-8CB89C92EEAC}.Debug|x86.ActiveCfg = Debug|Any CPU
{3677F48D-591D-4701-86E9-8CB89C92EEAC}.Debug|x86.Build.0 = Debug|Any CPU
{3677F48D-591D-4701-86E9-8CB89C92EEAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3677F48D-591D-4701-86E9-8CB89C92EEAC}.Release|Any CPU.Build.0 = Release|Any CPU
{3677F48D-591D-4701-86E9-8CB89C92EEAC}.Release|x64.ActiveCfg = Release|Any CPU
{3677F48D-591D-4701-86E9-8CB89C92EEAC}.Release|x64.Build.0 = Release|Any CPU
{3677F48D-591D-4701-86E9-8CB89C92EEAC}.Release|x86.ActiveCfg = Release|Any CPU
{3677F48D-591D-4701-86E9-8CB89C92EEAC}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1479,6 +1493,7 @@ Global
{CA12F503-6CE8-466C-A390-89AEE982DA64} = {574156BC-2074-47C9-8EA8-70DED6658DD5}
{229BDA36-5FEC-4277-979E-488CBBF403C2} = {53D45048-C7C6-4D04-A9DA-8B8271510F99}
{3B2C7634-1458-4FDF-9C12-8312A313F22F} = {53D45048-C7C6-4D04-A9DA-8B8271510F99}
{3677F48D-591D-4701-86E9-8CB89C92EEAC} = {6ED7E28F-0556-471C-8AD1-5BB0941411DD}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C6926E60-1F5A-4B05-B835-B1021FBE07C5}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
<PackageReference Include="Lombiq.DataTables.Tests.UI" Version="8.0.0" />
<PackageReference Include="Lombiq.Hosting.Azure.ApplicationInsights.Tests.UI" Version="8.0.0" />
<PackageReference Include="Lombiq.Hosting.BuildVersionDisplay.Tests.UI" Version="5.0.0" />
<PackageReference Include="Lombiq.Hosting.MediaTheme.Tests.UI" Version="6.0.0" />
<PackageReference Include="Lombiq.Hosting.MediaTheme.Bridge.Tests.UI" Version="6.0.1-alpha.2.osoe-835" />
<PackageReference Include="Lombiq.Hosting.MediaTheme.Tests.UI" Version="6.0.1-alpha.2.osoe-835" />
<PackageReference Include="Lombiq.Hosting.Tenants.EnvironmentRobots.Tests.UI" Version="7.0.0" />
<PackageReference Include="Lombiq.Hosting.Tenants.FeaturesGuard.Tests.UI" Version="7.0.0" />
<PackageReference Include="Lombiq.Hosting.Tenants.IdleTenantManagement.Tests.UI" Version="7.0.0" />
Expand All @@ -39,7 +40,7 @@
<PackageReference Include="Lombiq.OrchardCoreApiClient.Tests.UI" Version="5.0.1-alpha.1.osoe-838" />
<PackageReference Include="Lombiq.Privacy.Tests.UI" Version="8.0.0" />
<PackageReference Include="Lombiq.HelpfulExtensions.Tests.UI" Version="8.0.0" />
<PackageReference Include="Lombiq.Tests.UI" Version="10.0.0" />
<PackageReference Include="Lombiq.Tests.UI" Version="10.0.1-alpha.1.osoe-835" />
<PackageReference Include="Lombiq.VueJs.Tests.UI" Version="5.0.0" />
<PackageReference Include="Lombiq.Walkthroughs.Tests.UI" Version="1.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
using Lombiq.Hosting.MediaTheme.Bridge.Tests.UI.Extensions;
using Lombiq.Hosting.MediaTheme.Tests.UI.Extensions;
using Lombiq.Tests.UI.Extensions;
using Lombiq.Tests.UI.Pages;
using Lombiq.Tests.UI.Services;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
Expand All @@ -7,6 +11,7 @@ namespace Lombiq.OSOCE.NuGet.Tests.UI.Tests.ThemeTests;

public class BehaviorMediaThemeTests : UITestBase
{
private const string TestTenantName = "test";
public BehaviorMediaThemeTests(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
Expand All @@ -15,4 +20,24 @@ public BehaviorMediaThemeTests(ITestOutputHelper testOutputHelper)
[Fact]
public Task MediaThemeShouldRenderTemplatesFromMediaLibrary() =>
ExecuteTestAfterSetupAsync(context => context.TestMediaThemeDeployedBehaviorAsync());

[Fact]
public Task MediaThemeTemplateAccessShouldBeBlocked() =>
ExecuteTestAfterSetupAsync(async context =>
{
await CreateAndSwitchToTenantAsync(context);
await context.TestMediaThemeTemplatePageAsync();
});

private static Task CreateAndSwitchToTenantAsync(UITestContext context) =>
context.CreateAndSwitchToTenantAsync(
TestTenantName,
TestTenantName,
new OrchardCoreSetupParameters
{
SiteName = "Media Theme Test Tenant",
RecipeId = "Lombiq.OSOCE.Tests",
TablePrefix = TestTenantName,
UserName = "admin",
});
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Lombiq.Hosting.MediaTheme.Bridge.Tests.UI.Extensions;
using Lombiq.Hosting.MediaTheme.Tests.UI.Extensions;
using Lombiq.Tests.UI.Extensions;
using Lombiq.Tests.UI.Pages;
Expand Down Expand Up @@ -35,6 +36,14 @@ public Task MediaThemeShouldWorkLocally() =>
await context.TestMediaThemeLocalBehaviorAsync();
});

[Fact]
public Task MediaThemeTemplateAccessShouldBeBlocked() =>
ExecuteTestAfterSetupAsync(async context =>
{
await CreateAndSwitchToTenantAsync(context);
await context.TestMediaThemeTemplatePageAsync();
});

private static Task CreateAndSwitchToTenantAsync(UITestContext context) =>
context.CreateAndSwitchToTenantAsync(
TestTenantName,
Expand Down

0 comments on commit 0271928

Please sign in to comment.