Fixed unit tests
This commit is contained in:
@@ -30,15 +30,15 @@
|
||||
|
||||
namespace lms::db
|
||||
{
|
||||
MediaLibrary::MediaLibrary(const std::filesystem::path& p, std::string_view name)
|
||||
MediaLibrary::MediaLibrary(std::string_view name, const std::filesystem::path& p)
|
||||
: _name{ std::string{ name, 0, maxNameLength } }
|
||||
{
|
||||
setPath(p);
|
||||
}
|
||||
|
||||
MediaLibrary::pointer MediaLibrary::create(Session& session, const std::filesystem::path& p, std::string_view name)
|
||||
MediaLibrary::pointer MediaLibrary::create(Session& session, std::string_view name, const std::filesystem::path& p)
|
||||
{
|
||||
return session.getDboSession()->add(std::unique_ptr<MediaLibrary>{ new MediaLibrary{ p, name } });
|
||||
return session.getDboSession()->add(std::unique_ptr<MediaLibrary>{ new MediaLibrary{ name, p } });
|
||||
}
|
||||
|
||||
std::size_t MediaLibrary::getCount(Session& session)
|
||||
|
||||
@@ -64,8 +64,8 @@ namespace lms::db
|
||||
|
||||
private:
|
||||
friend class Session;
|
||||
MediaLibrary(const std::filesystem::path& p, std::string_view name);
|
||||
static pointer create(Session& session, const std::filesystem::path& p = {}, std::string_view name = {});
|
||||
MediaLibrary(std::string_view name, const std::filesystem::path& p);
|
||||
static pointer create(Session& session, std::string_view name, const std::filesystem::path& p);
|
||||
|
||||
std::filesystem::path _path;
|
||||
std::string _name;
|
||||
|
||||
@@ -89,8 +89,8 @@ namespace lms::db::tests
|
||||
ScopedArtist artist1{ session, "MyArtist1" };
|
||||
ScopedArtist artist2{ session, "MyArtist2" };
|
||||
ScopedArtist artist3{ session, "MyArtist3" };
|
||||
ScopedMediaLibrary library{ session };
|
||||
ScopedMediaLibrary otherLibrary{ session };
|
||||
ScopedMediaLibrary library{ session, "MyLibrary", "/root" };
|
||||
ScopedMediaLibrary otherLibrary{ session, "OtherLibrary", "/otherRoot" };
|
||||
|
||||
{
|
||||
auto transaction{ session.createWriteTransaction() };
|
||||
@@ -306,8 +306,8 @@ namespace lms::db::tests
|
||||
{
|
||||
ScopedTrack track{ session };
|
||||
ScopedArtist artist{ session, "MyArtist" };
|
||||
ScopedMediaLibrary library{ session };
|
||||
ScopedMediaLibrary otherLibrary{ session };
|
||||
ScopedMediaLibrary library{ session, "MyLibrary", "/root" };
|
||||
ScopedMediaLibrary otherLibrary{ session, "OtherLibrary", "/otherRoot" };
|
||||
|
||||
{
|
||||
auto transaction{ session.createWriteTransaction() };
|
||||
|
||||
@@ -260,7 +260,7 @@ namespace lms::db::tests
|
||||
ScopedDirectory parent2{ session, "/root_1" };
|
||||
ScopedDirectory child2{ session, "/root_1/foo" };
|
||||
|
||||
ScopedMediaLibrary library{ session, "/root" };
|
||||
ScopedMediaLibrary library{ session, "MyLibrary", "/root" };
|
||||
|
||||
{
|
||||
auto transaction{ session.createReadTransaction() };
|
||||
|
||||
@@ -343,8 +343,8 @@ namespace lms::db::tests
|
||||
ScopedUser user{ session, "MyUser" };
|
||||
const Wt::WDateTime dateTime1{ Wt::WDate{ 2000, 1, 2 }, Wt::WTime{ 12, 0, 1 } };
|
||||
ScopedListen listen{ session, user.lockAndGet(), track.lockAndGet(), ScrobblingBackend::Internal, dateTime1 };
|
||||
ScopedMediaLibrary library{ session };
|
||||
ScopedMediaLibrary otherLibrary{ session };
|
||||
ScopedMediaLibrary library{ session, "MyLibrary", "/root" };
|
||||
ScopedMediaLibrary otherLibrary{ session, "OtherLibrary", "/otherRoot" };
|
||||
|
||||
{
|
||||
auto transaction{ session.createReadTransaction() };
|
||||
@@ -563,8 +563,8 @@ namespace lms::db::tests
|
||||
ScopedUser user{ session, "MyUser" };
|
||||
const Wt::WDateTime dateTime{ Wt::WDate{ 2000, 1, 2 }, Wt::WTime{ 12, 0, 1 } };
|
||||
ScopedRelease release{ session, "MyRelease" };
|
||||
ScopedMediaLibrary library{ session };
|
||||
ScopedMediaLibrary otherLibrary{ session };
|
||||
ScopedMediaLibrary library{ session, "MyLibrary", "/root" };
|
||||
ScopedMediaLibrary otherLibrary{ session, "OtherLibrary", "/otherRoot" };
|
||||
|
||||
{
|
||||
auto transaction{ session.createWriteTransaction() };
|
||||
@@ -809,8 +809,8 @@ namespace lms::db::tests
|
||||
ScopedTrack track{ session };
|
||||
ScopedUser user{ session, "MyUser" };
|
||||
const Wt::WDateTime dateTime{ Wt::WDate{ 2000, 1, 2 }, Wt::WTime{ 12, 0, 1 } };
|
||||
ScopedMediaLibrary library{ session };
|
||||
ScopedMediaLibrary otherLibrary{ session };
|
||||
ScopedMediaLibrary library{ session, "MyLibrary", "/root" };
|
||||
ScopedMediaLibrary otherLibrary{ session, "OtherLibrary", "/otherRoot" };
|
||||
|
||||
{
|
||||
auto transaction{ session.createReadTransaction() };
|
||||
@@ -1051,8 +1051,8 @@ namespace lms::db::tests
|
||||
ScopedTrack track{ session };
|
||||
ScopedUser user{ session, "MyUser" };
|
||||
ScopedArtist artist{ session, "MyArtist" };
|
||||
ScopedMediaLibrary library{ session };
|
||||
ScopedMediaLibrary otherLibrary{ session };
|
||||
ScopedMediaLibrary library{ session, "MyLibrary", "/root" };
|
||||
ScopedMediaLibrary otherLibrary{ session, "OtherLibrary", "/otherRoot" };
|
||||
|
||||
{
|
||||
auto transaction{ session.createWriteTransaction() };
|
||||
@@ -1325,8 +1325,8 @@ namespace lms::db::tests
|
||||
ScopedTrack track{ session };
|
||||
ScopedUser user{ session, "MyUser" };
|
||||
ScopedRelease release{ session, "MyRelease" };
|
||||
ScopedMediaLibrary library{ session };
|
||||
ScopedMediaLibrary otherLibrary{ session };
|
||||
ScopedMediaLibrary library{ session, "MyLibrary", "/root" };
|
||||
ScopedMediaLibrary otherLibrary{ session, "OtherLibrary", "/otherRoot" };
|
||||
|
||||
{
|
||||
auto transaction{ session.createWriteTransaction() };
|
||||
@@ -1410,8 +1410,8 @@ namespace lms::db::tests
|
||||
{
|
||||
ScopedTrack track{ session };
|
||||
ScopedUser user{ session, "MyUser" };
|
||||
ScopedMediaLibrary library{ session };
|
||||
ScopedMediaLibrary otherLibrary{ session };
|
||||
ScopedMediaLibrary library{ session, "MyLibrary", "/root" };
|
||||
ScopedMediaLibrary otherLibrary{ session, "OtherLibrary", "/otherRoot" };
|
||||
|
||||
const Wt::WDateTime dateTime{ Wt::WDate{ 2000, 1, 2 }, Wt::WTime{ 12, 0, 1 } };
|
||||
ScopedListen listen1{ session, user.lockAndGet(), track.lockAndGet(), ScrobblingBackend::Internal, dateTime };
|
||||
|
||||
@@ -86,8 +86,8 @@ namespace lms::db::tests
|
||||
ScopedRelease release1{ session, "MyRelease1" };
|
||||
ScopedRelease release2{ session, "MyRelease2" };
|
||||
ScopedRelease release3{ session, "MyRelease3" };
|
||||
ScopedMediaLibrary library{ session };
|
||||
ScopedMediaLibrary otherLibrary{ session };
|
||||
ScopedMediaLibrary library{ session, "MyLibrary", "/root" };
|
||||
ScopedMediaLibrary otherLibrary{ session, "OtherLibrary", "/otherRoot" };
|
||||
|
||||
{
|
||||
auto transaction{ session.createWriteTransaction() };
|
||||
@@ -233,8 +233,8 @@ namespace lms::db::tests
|
||||
{
|
||||
ScopedTrack track{ session };
|
||||
ScopedRelease release{ session, "MyRelease" };
|
||||
ScopedMediaLibrary library{ session };
|
||||
ScopedMediaLibrary otherLibrary{ session };
|
||||
ScopedMediaLibrary library{ session, "MyLibrary", "/root" };
|
||||
ScopedMediaLibrary otherLibrary{ session, "OtherLibrary", "/otherRoot" };
|
||||
|
||||
{
|
||||
auto transaction{ session.createWriteTransaction() };
|
||||
|
||||
@@ -67,8 +67,8 @@ namespace lms::db::tests
|
||||
ScopedTrack track1{ session };
|
||||
ScopedTrack track2{ session };
|
||||
ScopedTrack track3{ session };
|
||||
ScopedMediaLibrary library{ session };
|
||||
ScopedMediaLibrary otherLibrary{ session };
|
||||
ScopedMediaLibrary library{ session, "MyLibrary", "/root" };
|
||||
ScopedMediaLibrary otherLibrary{ session, "OtherLibrary", "/otherRoot" };
|
||||
|
||||
{
|
||||
auto transaction{ session.createWriteTransaction() };
|
||||
@@ -148,8 +148,8 @@ namespace lms::db::tests
|
||||
TEST_F(DatabaseFixture, Track_MediaLibrary)
|
||||
{
|
||||
ScopedTrack track{ session };
|
||||
ScopedMediaLibrary library{ session };
|
||||
ScopedMediaLibrary otherLibrary{ session };
|
||||
ScopedMediaLibrary library{ session, "MyLibrary", "/root" };
|
||||
ScopedMediaLibrary otherLibrary{ session, "OtherLibrary", "/otherRoot" };
|
||||
|
||||
{
|
||||
auto transaction{ session.createWriteTransaction() };
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace lms::db::tests
|
||||
ScopedTrackList trackList2{ session, "MytrackList2", TrackListType::Playlist, false, user.lockAndGet() };
|
||||
ScopedTrack track1{ session };
|
||||
ScopedTrack track2{ session };
|
||||
ScopedMediaLibrary library{ session };
|
||||
ScopedMediaLibrary library{ session, "MyLibrary", "/root" };
|
||||
|
||||
{
|
||||
auto transaction{ session.createWriteTransaction() };
|
||||
|
||||
Reference in New Issue
Block a user