mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-18 21:34:28 -04:00
Create cache db in integration tests
This commit is contained in:
@@ -6,7 +6,6 @@ using NUnit.Framework;
|
|||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.Books;
|
using NzbDrone.Core.Books;
|
||||||
using NzbDrone.Core.Http;
|
using NzbDrone.Core.Http;
|
||||||
using NzbDrone.Core.MetadataSource;
|
|
||||||
using NzbDrone.Core.MetadataSource.BookInfo;
|
using NzbDrone.Core.MetadataSource.BookInfo;
|
||||||
using NzbDrone.Core.MetadataSource.Goodreads;
|
using NzbDrone.Core.MetadataSource.Goodreads;
|
||||||
using NzbDrone.Core.Profiles.Metadata;
|
using NzbDrone.Core.Profiles.Metadata;
|
||||||
@@ -86,9 +85,9 @@ namespace NzbDrone.Core.Test.MetadataSource.Goodreads
|
|||||||
ExceptionVerification.IgnoreWarns();
|
ExceptionVerification.IgnoreWarns();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCase("Philip Pullman", 0, typeof(Author), "Philip Pullman")]
|
[TestCase("Philip Pullman", 0, typeof(Author), new[] { "Philip Pullman" }, TestName = "author")]
|
||||||
[TestCase("Philip Pullman", 1, typeof(Book), "The Amber Spyglass")]
|
[TestCase("Philip Pullman", 1, typeof(Book), new[] { "Northern Lights", "The Amber Spyglass" }, TestName = "book")]
|
||||||
public void successful_combined_search(string query, int position, Type resultType, string expected)
|
public void successful_combined_search(string query, int position, Type resultType, string[] expected)
|
||||||
{
|
{
|
||||||
var result = Subject.SearchForNewEntity(query);
|
var result = Subject.SearchForNewEntity(query);
|
||||||
result.Should().NotBeEmpty();
|
result.Should().NotBeEmpty();
|
||||||
@@ -98,13 +97,13 @@ namespace NzbDrone.Core.Test.MetadataSource.Goodreads
|
|||||||
{
|
{
|
||||||
var cast = result[position] as Author;
|
var cast = result[position] as Author;
|
||||||
cast.Should().NotBeNull();
|
cast.Should().NotBeNull();
|
||||||
cast.Name.Should().Be(expected);
|
cast.Name.Should().ContainAll(expected);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var cast = result[position] as Book;
|
var cast = result[position] as Book;
|
||||||
cast.Should().NotBeNull();
|
cast.Should().NotBeNull();
|
||||||
cast.Title.Should().Be(expected);
|
cast.Title.Should().ContainAny(expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,12 +84,14 @@ namespace NzbDrone.Integration.Test
|
|||||||
{
|
{
|
||||||
PostgresDatabase.Create(options, MigrationType.Main);
|
PostgresDatabase.Create(options, MigrationType.Main);
|
||||||
PostgresDatabase.Create(options, MigrationType.Log);
|
PostgresDatabase.Create(options, MigrationType.Log);
|
||||||
|
PostgresDatabase.Create(options, MigrationType.Cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void DropPostgresDb(PostgresOptions options)
|
private static void DropPostgresDb(PostgresOptions options)
|
||||||
{
|
{
|
||||||
PostgresDatabase.Drop(options, MigrationType.Main);
|
PostgresDatabase.Drop(options, MigrationType.Main);
|
||||||
PostgresDatabase.Drop(options, MigrationType.Log);
|
PostgresDatabase.Drop(options, MigrationType.Log);
|
||||||
|
PostgresDatabase.Drop(options, MigrationType.Cache);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace NzbDrone.Test.Common.Datastore
|
|||||||
var uid = TestBase.GetUID();
|
var uid = TestBase.GetUID();
|
||||||
options.MainDb = uid + "_main";
|
options.MainDb = uid + "_main";
|
||||||
options.LogDb = uid + "_log";
|
options.LogDb = uid + "_log";
|
||||||
|
options.CacheDb = uid + "_cache";
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
@@ -62,6 +63,7 @@ namespace NzbDrone.Test.Common.Datastore
|
|||||||
{
|
{
|
||||||
MigrationType.Main => options.MainDb,
|
MigrationType.Main => options.MainDb,
|
||||||
MigrationType.Log => options.LogDb,
|
MigrationType.Log => options.LogDb,
|
||||||
|
MigrationType.Cache => options.CacheDb,
|
||||||
_ => throw new NotImplementedException("Unknown migration type")
|
_ => throw new NotImplementedException("Unknown migration type")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user