added test to webstudioDbContext Data = Completed:false
This commit is contained in:
parent
17a0a6bb9d
commit
8be7427764
@ -8,6 +8,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="NUnit" Version="3.13.1" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||
<PackageReference Include="coverlet.collector" Version="3.0.2" />
|
||||
|
@ -6,6 +6,7 @@ using ASC.Common.Logging;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Common.EF;
|
||||
using ASC.Core.Common.EF.Context;
|
||||
using ASC.Core.Common.EF.Model;
|
||||
using ASC.Core.Common.Settings;
|
||||
using ASC.Core.Tenants;
|
||||
using ASC.Web.Api.Controllers;
|
||||
@ -71,8 +72,8 @@ namespace ASC.Web.Api.Tests
|
||||
protected SecurityContext SecurityContext { get; set; }
|
||||
protected UserOptions UserOptions { get; set; }
|
||||
protected IServiceScope scope { get; set; }
|
||||
protected WizardSettings wizardSettings { get; set; }
|
||||
protected SettingsManager settingsManager { get; set; }
|
||||
protected DbWebstudioSettings dbWebStudioSettings { get; set; }
|
||||
|
||||
protected FirstTimeTenantSettings firstTimeTenantSettings { get; set; }
|
||||
|
||||
@ -93,12 +94,14 @@ namespace ASC.Web.Api.Tests
|
||||
|
||||
firstTimeTenantSettings = scope.ServiceProvider.GetService<FirstTimeTenantSettings>();
|
||||
settingsManager = scope.ServiceProvider.GetService<SettingsManager>();
|
||||
wizardSettings = scope.ServiceProvider.GetService<WizardSettings>();
|
||||
dbWebStudioSettings = scope.ServiceProvider.GetService<DbWebstudioSettings>();
|
||||
UserManager = scope.ServiceProvider.GetService<UserManager>();
|
||||
SecurityContext = scope.ServiceProvider.GetService<SecurityContext>();
|
||||
UserOptions = scope.ServiceProvider.GetService<IOptions<UserOptions>>().Value;
|
||||
Log = scope.ServiceProvider.GetService<IOptionsMonitor<ILog>>().CurrentValue;
|
||||
SecurityContext.AuthenticateMe(CurrentTenant.OwnerId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ASC.Web.Api.Tests.Infrastructure
|
||||
@ -10,5 +11,10 @@ namespace ASC.Web.Api.Tests.Infrastructure
|
||||
yield return new TestCaseData("testuser@onlyoffice.com", "00000000", "en-US", "UTC", "", "", false);
|
||||
}
|
||||
|
||||
public static IEnumerable<TestCaseData> WebStudioSettingsData()
|
||||
{
|
||||
yield return new TestCaseData(1, Guid.Parse("00000000-0000-0000-0000-000000000000"), "{\"Completed\":false}");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
656
common/Tests/ASC.Web.Api.Tests/TestMigrations/20210309174659_TestMigration.Designer.cs
generated
Normal file
656
common/Tests/ASC.Web.Api.Tests/TestMigrations/20210309174659_TestMigration.Designer.cs
generated
Normal file
@ -0,0 +1,656 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using ASC.Core.Common.EF.Context;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace ASC.Core.Common.Migrations.MySql.TenantDbContextMySql
|
||||
{
|
||||
[DbContext(typeof(MySqlTenantDbContext))]
|
||||
[Migration("20210309174659_TestMigration")]
|
||||
partial class TestMigration
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64)
|
||||
.HasAnnotation("ProductVersion", "5.0.3");
|
||||
|
||||
modelBuilder.Entity("ASC.Core.Common.EF.Model.DbCoreSettings", b =>
|
||||
{
|
||||
b.Property<int>("Tenant")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("tenant");
|
||||
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("varchar(128)")
|
||||
.HasColumnName("id")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<DateTime>("LastModified")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("timestamp")
|
||||
.HasColumnName("last_modified")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<byte[]>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("mediumblob")
|
||||
.HasColumnName("value");
|
||||
|
||||
b.HasKey("Tenant", "Id")
|
||||
.HasName("PRIMARY");
|
||||
|
||||
b.ToTable("core_settings");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Tenant = -1,
|
||||
Id = "CompanyWhiteLabelSettings",
|
||||
LastModified = new DateTime(2021, 3, 9, 17, 46, 59, 99, DateTimeKind.Utc).AddTicks(7085),
|
||||
Value = new byte[] { 48, 120, 70, 53, 52, 55, 48, 52, 56, 65, 52, 56, 54, 53, 49, 55, 49, 53, 56, 55, 68, 57, 67, 69, 66, 67, 56, 65, 52, 57, 54, 67, 54, 48, 49, 68, 57, 54, 48, 51, 49, 70, 50, 67, 49, 67, 51, 69, 57, 49, 54, 48, 51, 53, 51, 57, 52, 50, 69, 69, 55, 54, 53, 68, 65, 67, 68, 51, 49, 54, 70, 52, 66, 53, 70, 52, 50, 56, 57, 50, 52, 51, 54, 70, 67, 52, 65, 50, 49, 66, 57, 65, 54, 68, 70, 56, 70, 70, 68, 51, 66, 67, 52, 48, 51, 54, 66, 52, 55, 69, 51, 65, 53, 65, 49, 66, 52, 67, 56, 56, 49, 66, 50, 54, 54, 48, 57, 56, 54, 57, 70, 69, 66, 66, 54, 56, 52, 56, 66, 68, 56, 56, 67, 48, 50, 69, 69, 65, 67, 54, 65, 52, 67, 67, 66, 51, 69, 56, 70, 52, 48, 52, 50, 57, 48, 56, 49, 50, 70, 48, 69, 54, 69, 49, 50, 52, 65, 53, 53, 50, 66, 69, 56, 49, 65, 53, 56, 67, 54, 52, 66, 66, 56, 66, 68, 51, 67, 57, 65, 56, 67, 48, 69, 68, 69, 49, 70, 57, 52, 50, 49, 50, 56, 49, 68, 69, 48, 67, 55, 65, 70, 56, 50, 55, 51, 51, 67, 48, 66, 55, 53, 52, 69, 57, 55, 69, 70, 70, 70, 65, 53, 65, 55, 53, 54, 48, 55, 65, 57, 49, 57, 53, 55, 56, 57, 54, 67, 66, 69, 67, 70, 57, 53, 54, 51, 70, 67, 56, 51, 49, 51, 48, 48, 68, 67, 56, 69, 55, 67, 57, 51, 48, 65, 53, 53, 66, 50, 57, 56, 69, 66, 56, 50, 68, 54, 70, 54, 57, 69, 48, 69, 68, 54, 69, 52, 68, 56, 55, 53, 50, 54, 48, 55, 70, 49, 56, 56, 49, 70, 54, 49, 66, 48, 51, 50, 51, 48, 54, 69, 48, 70, 48, 54, 57, 65, 53, 70, 54, 57, 70, 48, 56, 54, 65, 49, 55, 55, 69, 66, 52, 49, 65, 67, 48, 54, 70, 56, 56, 57, 69, 66, 48, 66, 51, 57, 67, 66, 70, 68, 52, 66, 53, 67, 68, 66, 55, 54, 51, 69, 57, 57, 54, 53, 53, 52, 68, 69, 65, 68, 66, 57, 67, 55, 49, 67, 70, 51, 69, 70, 56, 54, 70, 52, 65, 48, 51, 53, 52, 65, 56, 54, 52, 65, 49, 48, 54, 51, 57, 68, 70, 68, 50, 57, 66, 53, 67, 54, 68, 53, 68, 67, 68, 65, 57, 68, 52, 66, 48, 57, 56, 56, 69, 69, 52, 48, 54, 57, 52, 56, 66, 67, 66, 53, 52, 67, 54, 65, 55, 48, 65, 68, 67, 54, 67, 48, 48, 53, 55, 55, 49, 55, 52, 50, 56, 53, 67, 69, 66, 67, 68, 55, 54 }
|
||||
},
|
||||
new
|
||||
{
|
||||
Tenant = -1,
|
||||
Id = "FullTextSearchSettings",
|
||||
LastModified = new DateTime(2021, 3, 9, 17, 46, 59, 99, DateTimeKind.Utc).AddTicks(7405),
|
||||
Value = new byte[] { 48, 120, 48, 56, 55, 56, 67, 70, 48, 53, 57, 57, 66, 53, 49, 55, 67, 65, 65, 50, 68, 51, 68, 65, 69, 68, 57, 68, 48, 54, 52, 67, 51, 69, 68, 67, 69, 69, 65, 70, 52, 51, 49, 70, 51, 53, 65, 54, 70, 54, 52, 50, 68, 67, 65, 68, 65, 48, 52, 56, 49, 55, 69, 51, 53, 49, 51, 50, 50, 55, 66, 66, 66, 49, 68, 69, 54, 69, 50, 66, 65, 66, 69, 66, 57, 69, 49, 48, 55, 55, 66, 50, 67, 70, 51, 49, 56, 67, 52, 56, 57, 56, 49, 52, 53, 52, 53, 69, 56, 55, 55, 53, 48, 49, 70, 54, 51, 51, 70, 66, 66, 69, 57, 52, 48, 50, 50, 67, 70, 67, 68, 68, 48, 50, 53, 66, 53, 51, 57, 53, 57, 55, 51, 65, 70, 53, 49, 48, 57, 52, 51, 52, 48, 56, 66, 66, 53, 54, 57, 54, 50, 69, 69, 51, 53, 68, 65, 51, 53, 70, 50, 70, 56, 51, 55, 52, 67, 70, 53, 70, 68, 49, 50, 54, 57, 53, 51, 53, 57, 52, 52, 57, 68, 55, 67, 69, 70, 66, 67, 50, 67, 55, 66, 68, 49, 49, 50, 65, 69, 53, 56, 55, 53, 50, 49, 55, 57, 65, 65, 50, 65, 53, 57, 69, 53, 69, 49, 55, 56, 48, 49, 69, 53, 56, 48, 67, 67, 67, 54, 48, 70, 65, 69, 67, 56, 69, 66, 68, 68, 51, 68, 54, 49, 50, 67, 52, 56, 56, 54, 54, 54, 54, 68, 57, 54, 68, 54, 67, 70, 48, 54, 48, 54, 48, 53, 69, 54, 52, 67, 57, 48, 65, 49, 70, 65, 65, 56, 48, 67, 48 }
|
||||
},
|
||||
new
|
||||
{
|
||||
Tenant = -1,
|
||||
Id = "SmtpSettings",
|
||||
LastModified = new DateTime(2021, 3, 9, 17, 46, 59, 99, DateTimeKind.Utc).AddTicks(7411),
|
||||
Value = new byte[] { 48, 120, 70, 48, 53, 50, 69, 48, 57, 48, 65, 49, 65, 51, 55, 53, 48, 68, 65, 68, 67, 68, 52, 69, 57, 57, 54, 49, 68, 65, 48, 52, 65, 65, 53, 49, 69, 70, 48, 49, 57, 55, 69, 50, 67, 48, 54, 50, 51, 67, 70, 49, 50, 67, 53, 56, 51, 56, 66, 70, 65, 52, 48, 65, 57, 66, 52, 56, 66, 65, 69, 70, 67, 66, 69, 51, 55, 49, 53, 56, 55, 55, 51, 49, 68, 55, 69, 51, 68, 67, 57, 69, 55, 67, 54, 48, 48, 57, 55, 52, 50, 70, 57, 69, 52, 49, 53, 68, 53, 54, 68, 66, 48, 70, 48, 65, 69, 48, 56, 69, 51, 50, 70, 56, 57, 48, 52, 66, 50, 67, 52, 52, 49, 67, 67, 54, 53, 55, 67, 54, 52, 53, 52, 51, 69, 65, 69, 69, 50, 54, 50, 48, 52, 52, 65, 50, 56, 66, 52, 51, 51, 53, 68, 67, 66, 48, 70, 48, 67, 52, 69, 57, 52, 48, 49, 68, 56, 57, 49, 70, 65, 48, 54, 51, 54, 57, 70, 57, 56, 52, 67, 65, 50, 68, 52, 55, 53, 67, 56, 54, 67, 50, 51, 55, 57, 49, 55, 57, 54, 49, 67, 53, 56, 50, 55, 55, 54, 57, 56, 51, 49, 53, 56, 53, 50, 51, 48, 65, 54, 54, 65, 67, 55, 55, 56, 55, 69, 54, 70, 66, 53, 54, 70, 68, 51, 69, 51, 55, 51, 56, 57, 50, 54, 55, 65, 52, 54, 65 }
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ASC.Core.Common.EF.Model.DbTenant", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Alias")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(100)")
|
||||
.HasColumnName("alias")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<bool>("Calls")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasColumnName("calls")
|
||||
.HasDefaultValueSql("true");
|
||||
|
||||
b.Property<DateTime>("CreationDateTime")
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("creationdatetime");
|
||||
|
||||
b.Property<int?>("Industry")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("industry");
|
||||
|
||||
b.Property<string>("Language")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(10)")
|
||||
.HasColumnName("language")
|
||||
.HasDefaultValueSql("'en-US'")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<DateTime>("LastModified")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp")
|
||||
.HasColumnName("last_modified")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<string>("MappedDomain")
|
||||
.HasColumnType("varchar(100)")
|
||||
.HasColumnName("mappeddomain")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(255)")
|
||||
.HasColumnName("name")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<string>("OwnerId")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(38)")
|
||||
.HasColumnName("owner_id")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<string>("PaymentId")
|
||||
.HasColumnType("varchar(38)")
|
||||
.HasColumnName("payment_id")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<bool>("Public")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasColumnName("public");
|
||||
|
||||
b.Property<string>("PublicVisibleProducts")
|
||||
.HasColumnType("varchar(1024)")
|
||||
.HasColumnName("publicvisibleproducts")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<bool>("Spam")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasColumnName("spam")
|
||||
.HasDefaultValueSql("true");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<DateTime?>("StatusChanged")
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("statuschanged");
|
||||
|
||||
b.Property<string>("TimeZone")
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("timezone")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<string>("TrustedDomains")
|
||||
.HasColumnType("varchar(1024)")
|
||||
.HasColumnName("trusteddomains")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<int>("TrustedDomainsEnabled")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("trusteddomainsenabled")
|
||||
.HasDefaultValueSql("'1'");
|
||||
|
||||
b.Property<int>("Version")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("version")
|
||||
.HasDefaultValueSql("'2'");
|
||||
|
||||
b.Property<DateTime?>("Version_Changed")
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("version_changed");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("LastModified")
|
||||
.HasDatabaseName("last_modified");
|
||||
|
||||
b.HasIndex("MappedDomain")
|
||||
.HasDatabaseName("mappeddomain");
|
||||
|
||||
b.HasIndex("Version")
|
||||
.HasDatabaseName("version");
|
||||
|
||||
b.ToTable("tenants_tenants");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Alias = "localhost",
|
||||
Calls = false,
|
||||
CreationDateTime = new DateTime(2021, 3, 9, 17, 46, 59, 97, DateTimeKind.Utc).AddTicks(4317),
|
||||
LastModified = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Name = "Web Office",
|
||||
OwnerId = "66faa6e4-f133-11ea-b126-00ffeec8b4ef",
|
||||
Public = false,
|
||||
Spam = false,
|
||||
Status = 0,
|
||||
TrustedDomainsEnabled = 0,
|
||||
Version = 0
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ASC.Core.Common.EF.Model.DbTenantForbiden", b =>
|
||||
{
|
||||
b.Property<string>("Address")
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("address")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.HasKey("Address")
|
||||
.HasName("PRIMARY");
|
||||
|
||||
b.ToTable("tenants_forbiden");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Address = "controlpanel"
|
||||
},
|
||||
new
|
||||
{
|
||||
Address = "localhost"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ASC.Core.Common.EF.Model.DbTenantPartner", b =>
|
||||
{
|
||||
b.Property<int>("TenantId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("tenant_id");
|
||||
|
||||
b.Property<string>("AffiliateId")
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("affiliate_id")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<string>("Campaign")
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("campaign")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<string>("PartnerId")
|
||||
.HasColumnType("varchar(36)")
|
||||
.HasColumnName("partner_id")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.HasKey("TenantId")
|
||||
.HasName("PRIMARY");
|
||||
|
||||
b.ToTable("tenants_partners");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ASC.Core.Common.EF.Model.DbTenantVersion", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<int>("DefaultVersion")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("default_version");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(64)")
|
||||
.HasColumnName("url")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(64)")
|
||||
.HasColumnName("version")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<bool>("Visible")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasColumnName("visible");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("tenants_version");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ASC.Core.Common.EF.Model.TenantIpRestrictions", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Ip")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("ip")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<int>("Tenant")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("tenant");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Tenant")
|
||||
.HasDatabaseName("tenant");
|
||||
|
||||
b.ToTable("tenants_iprestrictions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ASC.Core.Common.EF.User", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("varchar(38)")
|
||||
.HasColumnName("id")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<int>("ActivationStatus")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("activation_status");
|
||||
|
||||
b.Property<DateTime?>("Birthdate")
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("bithdate");
|
||||
|
||||
b.Property<string>("Contacts")
|
||||
.HasColumnType("varchar(1024)")
|
||||
.HasColumnName("contacts")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<DateTime>("CreateOn")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp")
|
||||
.HasColumnName("create_on")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<string>("Culture")
|
||||
.HasColumnType("varchar(20)")
|
||||
.HasColumnName("culture")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("varchar(255)")
|
||||
.HasColumnName("email")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(64)")
|
||||
.HasColumnName("firstname")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<DateTime>("LastModified")
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("last_modified");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(64)")
|
||||
.HasColumnName("lastname")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<string>("Location")
|
||||
.HasColumnType("varchar(255)")
|
||||
.HasColumnName("location")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<string>("Notes")
|
||||
.HasColumnType("varchar(512)")
|
||||
.HasColumnName("notes")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.HasColumnType("varchar(255)")
|
||||
.HasColumnName("phone")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<int>("PhoneActivation")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("phone_activation");
|
||||
|
||||
b.Property<bool>("Removed")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasColumnName("removed");
|
||||
|
||||
b.Property<bool?>("Sex")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasColumnName("sex");
|
||||
|
||||
b.Property<string>("Sid")
|
||||
.HasColumnType("varchar(512)")
|
||||
.HasColumnName("sid")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<string>("SsoNameId")
|
||||
.HasColumnType("varchar(512)")
|
||||
.HasColumnName("sso_name_id")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<string>("SsoSessionId")
|
||||
.HasColumnType("varchar(512)")
|
||||
.HasColumnName("sso_session_id")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("status")
|
||||
.HasDefaultValueSql("'1'");
|
||||
|
||||
b.Property<int>("Tenant")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("tenant");
|
||||
|
||||
b.Property<DateTime?>("TerminatedDate")
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("terminateddate");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("varchar(64)")
|
||||
.HasColumnName("title")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(255)")
|
||||
.HasColumnName("username")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<DateTime?>("WorkFromDate")
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("workfromdate");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Email")
|
||||
.HasDatabaseName("email");
|
||||
|
||||
b.HasIndex("LastModified")
|
||||
.HasDatabaseName("last_modified");
|
||||
|
||||
b.HasIndex("Tenant", "UserName")
|
||||
.HasDatabaseName("username");
|
||||
|
||||
b.ToTable("core_user");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = "66faa6e4-f133-11ea-b126-00ffeec8b4ef",
|
||||
ActivationStatus = 0,
|
||||
CreateOn = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Email = "",
|
||||
FirstName = "Administrator",
|
||||
LastModified = new DateTime(2021, 3, 9, 17, 46, 59, 90, DateTimeKind.Utc).AddTicks(9324),
|
||||
LastName = "",
|
||||
PhoneActivation = 0,
|
||||
Removed = false,
|
||||
Status = 1,
|
||||
Tenant = 1,
|
||||
UserName = "administrator",
|
||||
WorkFromDate = new DateTime(2021, 3, 9, 17, 46, 59, 90, DateTimeKind.Utc).AddTicks(8614)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = "005bb3ff-7de3-47d2-9b3d-61b9ec8a76a5",
|
||||
ActivationStatus = 0,
|
||||
CreateOn = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Email = "test@gmail.com",
|
||||
FirstName = "Test",
|
||||
LastModified = new DateTime(2021, 3, 9, 17, 46, 59, 90, DateTimeKind.Utc).AddTicks(9616),
|
||||
LastName = "User",
|
||||
PhoneActivation = 0,
|
||||
Removed = false,
|
||||
Status = 1,
|
||||
Tenant = 1,
|
||||
UserName = "TestUser",
|
||||
WorkFromDate = new DateTime(2021, 3, 9, 17, 46, 59, 90, DateTimeKind.Utc).AddTicks(9613)
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ASC.Core.Common.EF.UserGroup", b =>
|
||||
{
|
||||
b.Property<int>("Tenant")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("tenant");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("varchar(38)")
|
||||
.HasColumnName("userid")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<string>("GroupId")
|
||||
.HasColumnType("varchar(38)")
|
||||
.HasColumnName("groupid")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<int>("RefType")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("ref_type");
|
||||
|
||||
b.Property<DateTime>("LastModified")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp")
|
||||
.HasColumnName("last_modified")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<bool>("Removed")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasColumnName("removed");
|
||||
|
||||
b.HasKey("Tenant", "UserId", "GroupId", "RefType")
|
||||
.HasName("PRIMARY");
|
||||
|
||||
b.HasIndex("LastModified")
|
||||
.HasDatabaseName("last_modified");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("core_usergroup");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ASC.Core.Common.EF.UserSecurity", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("varchar(38)")
|
||||
.HasColumnName("userid")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<DateTime?>("LastModified")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("timestamp")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<string>("PwdHash")
|
||||
.HasColumnType("varchar(512)")
|
||||
.HasColumnName("pwdhash")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<string>("PwdHashSha512")
|
||||
.HasColumnType("varchar(512)")
|
||||
.HasColumnName("pwdhashsha512")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
b.Property<int>("Tenant")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("tenant");
|
||||
|
||||
b.HasKey("UserId")
|
||||
.HasName("PRIMARY");
|
||||
|
||||
b.HasIndex("PwdHash")
|
||||
.HasDatabaseName("pwdhash");
|
||||
|
||||
b.HasIndex("Tenant")
|
||||
.HasDatabaseName("tenant");
|
||||
|
||||
b.ToTable("core_usersecurity");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
UserId = "66faa6e4-f133-11ea-b126-00ffeec8b4ef",
|
||||
LastModified = new DateTime(2021, 3, 9, 17, 46, 59, 101, DateTimeKind.Utc).AddTicks(8498),
|
||||
PwdHash = "vLFfghR5tNV3K9DKhmwArV+SbjWAcgZZzIDTnJ0JgCo=",
|
||||
PwdHashSha512 = "USubvPlB+ogq0Q1trcSupg==",
|
||||
Tenant = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
UserId = "005bb3ff-7de3-47d2-9b3d-61b9ec8a76a5",
|
||||
LastModified = new DateTime(2021, 3, 9, 17, 46, 59, 101, DateTimeKind.Utc).AddTicks(8834),
|
||||
PwdHash = "vLFfghR5tNV3K9DKhmwArV+SbjWAcgZZzIDTnJ0JgCo=",
|
||||
PwdHashSha512 = "USubvPlB+ogq0Q1trcSupg==",
|
||||
Tenant = 1
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ASC.Core.Common.EF.UserGroup", b =>
|
||||
{
|
||||
b.HasOne("ASC.Core.Common.EF.User", null)
|
||||
.WithMany("Groups")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ASC.Core.Common.EF.UserSecurity", b =>
|
||||
{
|
||||
b.HasOne("ASC.Core.Common.EF.User", null)
|
||||
.WithOne("UserSecurity")
|
||||
.HasForeignKey("ASC.Core.Common.EF.UserSecurity", "UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ASC.Core.Common.EF.User", b =>
|
||||
{
|
||||
b.Navigation("Groups");
|
||||
|
||||
b.Navigation("UserSecurity");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ASC.Core.Common.Migrations.MySql.TenantDbContextMySql
|
||||
{
|
||||
public partial class TestMigration : Microsoft.EntityFrameworkCore.Migrations.Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "core_user",
|
||||
keyColumn: "id",
|
||||
keyValue: "005bb3ff-7de3-47d2-9b3d-61b9ec8a76a5",
|
||||
columns: new[] { "last_modified", "workfromdate" },
|
||||
values: new object[] { new DateTime(2021, 3, 9, 17, 46, 59, 90, DateTimeKind.Utc).AddTicks(9616), new DateTime(2021, 3, 9, 17, 46, 59, 90, DateTimeKind.Utc).AddTicks(9613) });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "core_user",
|
||||
columns: new[] { "id", "activation_status", "bithdate", "contacts", "culture", "email", "firstname", "last_modified", "lastname", "location", "notes", "phone", "phone_activation", "removed", "sex", "sid", "sso_name_id", "sso_session_id", "status", "tenant", "terminateddate", "title", "username", "workfromdate" },
|
||||
values: new object[] { "99223c7b-e3c9-11eb-9063-982cbc0ea1e5", 0, null, null, null, "", "Test", new DateTime(2020, 12, 22, 15, 29, 45, 332, DateTimeKind.Utc).AddTicks(3070), "User", null, null, null, 0, false, null, null, null, null, 1, 1, null, null, "TestUser", new DateTime(2020, 12, 22, 15, 29, 45, 332, DateTimeKind.Utc).AddTicks(3053) });
|
||||
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "core_user",
|
||||
keyColumn: "id",
|
||||
keyValue: "66faa6e4-f133-11ea-b126-00ffeec8b4ef",
|
||||
columns: new[] { "last_modified", "workfromdate" },
|
||||
values: new object[] { new DateTime(2021, 3, 9, 17, 46, 59, 90, DateTimeKind.Utc).AddTicks(9324), new DateTime(2021, 3, 9, 17, 46, 59, 90, DateTimeKind.Utc).AddTicks(8614) });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "core_usersecurity",
|
||||
columns: new[] { "userid", "pwdhash", "pwdhashsha512", "tenant" },
|
||||
values: new object[] { "99223c7b-e3c9-11eb-9063-982cbc0ea1e5", "", "USubvPlB+ogq0Q1trcSupg==", 1 });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "tenants_tenants",
|
||||
keyColumn: "id",
|
||||
keyValue: 1,
|
||||
column: "creationdatetime",
|
||||
value: new DateTime(2021, 3, 9, 17, 46, 59, 97, DateTimeKind.Utc).AddTicks(4317));
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.UpdateData(
|
||||
table: "core_user",
|
||||
keyColumn: "id",
|
||||
keyValue: "005bb3ff-7de3-47d2-9b3d-61b9ec8a76a5",
|
||||
columns: new[] { "last_modified", "workfromdate" },
|
||||
values: new object[] { new DateTime(2021, 3, 9, 17, 44, 25, 638, DateTimeKind.Utc).AddTicks(9818), new DateTime(2021, 3, 9, 17, 44, 25, 638, DateTimeKind.Utc).AddTicks(9814) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "core_user",
|
||||
keyColumn: "id",
|
||||
keyValue: "66faa6e4-f133-11ea-b126-00ffeec8b4ef",
|
||||
columns: new[] { "last_modified", "workfromdate" },
|
||||
values: new object[] { new DateTime(2021, 3, 9, 17, 44, 25, 638, DateTimeKind.Utc).AddTicks(9220), new DateTime(2021, 3, 9, 17, 44, 25, 638, DateTimeKind.Utc).AddTicks(7799) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "tenants_tenants",
|
||||
keyColumn: "id",
|
||||
keyValue: 1,
|
||||
column: "creationdatetime",
|
||||
value: new DateTime(2021, 3, 9, 17, 44, 25, 651, DateTimeKind.Utc).AddTicks(4834));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
using System;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Common.Settings;
|
||||
using ASC.Core.Common.EF.Context;
|
||||
using ASC.Core.Common.EF.Model;
|
||||
using ASC.Core.Data;
|
||||
using ASC.Core.Users;
|
||||
using ASC.Web.Api.Models;
|
||||
using ASC.Web.Api.Tests.Infrastructure;
|
||||
using ASC.Web.Core.Utility.Settings;
|
||||
using ASC.Web.Studio.UserControls.FirstTime;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ASC.Web.Api.Tests
|
||||
@ -16,6 +16,11 @@ namespace ASC.Web.Api.Tests
|
||||
class WizardTest : BaseApiTests
|
||||
{
|
||||
public UserInfo NewUser { get; set; }
|
||||
public WebstudioDbContext webstudioDbContext { get; set; }
|
||||
public DbSettingsManager dbSettingsManager { get; set; }
|
||||
|
||||
public IServiceProvider ServiceProvider { get; set; }
|
||||
public WizardSettings wizardSettings { get; set; }
|
||||
|
||||
[OneTimeSetUp]
|
||||
public override void SetUp()
|
||||
@ -24,10 +29,31 @@ namespace ASC.Web.Api.Tests
|
||||
NewUser = UserManager.GetUsers(CurrentTenant.OwnerId);
|
||||
}
|
||||
|
||||
|
||||
[TestCaseSource(typeof(ApiTestsData), nameof(ApiTestsData.UserForWizard))]
|
||||
[TestCaseSource(typeof(ApiTestsData), nameof(ApiTestsData.WebStudioSettingsData))]
|
||||
[Category("Wizard")]
|
||||
[Order(1)]
|
||||
public void WizardDataTest(int tenant, Guid userId, string data)
|
||||
{
|
||||
var user = UserManager.GetUsers(Guid.Parse("99223c7b-e3c9-11eb-9063-982cbc0ea1e5"));
|
||||
SecurityContext.AuthenticateMe(user.ID);
|
||||
var WebStudioData = new DbWebstudioSettings
|
||||
{
|
||||
TenantId = tenant,
|
||||
Id = user.ID,
|
||||
UserId = userId,
|
||||
Data = data
|
||||
};
|
||||
|
||||
var wizard = settingsManager.Load<WizardSettings>();
|
||||
var json = JsonConvert.SerializeObject(wizard.Completed);
|
||||
var jsonString = "{\"" + $"Completed\":{json}" + "}";
|
||||
Assert.AreEqual(WebStudioData.Data, jsonString);
|
||||
}
|
||||
|
||||
|
||||
[TestCaseSource(typeof(ApiTestsData), nameof(ApiTestsData.UserForWizard))]
|
||||
[Category("Wizard")]
|
||||
[Order(2)]
|
||||
public void WizardSaveDataTest(string email, string passwordHash, string lng, string timeZone, string promocode, string amiid, bool subscribeFromSite)
|
||||
{
|
||||
var wizardModel = new WizardModel
|
||||
@ -46,6 +72,5 @@ namespace ASC.Web.Api.Tests
|
||||
Assert.Throws<Exception>(() => firstTimeTenantSettings.SaveData(wizardModel));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user