mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-21 22:03:15 -07:00
Removing tests for musicbrainz
This commit is contained in:
parent
b69bc3d83a
commit
ddb58fb8a5
1 changed files with 1 additions and 109 deletions
|
@ -5,12 +5,10 @@ using System.Threading.Tasks;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using AutoFixture;
|
using AutoFixture;
|
||||||
using Hqub.MusicBrainz.API.Entities;
|
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Ombi.Api.Lidarr;
|
using Ombi.Api.Lidarr;
|
||||||
using Ombi.Api.Lidarr.Models;
|
using Ombi.Api.Lidarr.Models;
|
||||||
using Ombi.Api.MusicBrainz;
|
|
||||||
using Ombi.Core.Engine.V2;
|
using Ombi.Core.Engine.V2;
|
||||||
using Ombi.Core.Models.Requests;
|
using Ombi.Core.Models.Requests;
|
||||||
using Ombi.Core.Models.Search.V2.Music;
|
using Ombi.Core.Models.Search.V2.Music;
|
||||||
|
@ -22,7 +20,6 @@ using Ombi.Settings.Settings.Models.External;
|
||||||
using Ombi.Store.Entities;
|
using Ombi.Store.Entities;
|
||||||
using Ombi.Store.Repository;
|
using Ombi.Store.Repository;
|
||||||
using Ombi.Test.Common;
|
using Ombi.Test.Common;
|
||||||
using Artist = Hqub.MusicBrainz.API.Entities.Artist;
|
|
||||||
|
|
||||||
namespace Ombi.Core.Tests.Engine.V2
|
namespace Ombi.Core.Tests.Engine.V2
|
||||||
{
|
{
|
||||||
|
@ -32,7 +29,7 @@ namespace Ombi.Core.Tests.Engine.V2
|
||||||
|
|
||||||
private MusicSearchEngineV2 _engine;
|
private MusicSearchEngineV2 _engine;
|
||||||
|
|
||||||
private Mock<IMusicBrainzApi> _musicApi;
|
// private Mock<ILidarrApi> _musicApi;
|
||||||
private Mock<ILidarrApi> _lidarrApi;
|
private Mock<ILidarrApi> _lidarrApi;
|
||||||
private Mock<ISettingsService<LidarrSettings>> _lidarrSettings;
|
private Mock<ISettingsService<LidarrSettings>> _lidarrSettings;
|
||||||
private Fixture F;
|
private Fixture F;
|
||||||
|
@ -52,7 +49,6 @@ namespace Ombi.Core.Tests.Engine.V2
|
||||||
var cache = new Mock<ICacheService>();
|
var cache = new Mock<ICacheService>();
|
||||||
var ombiSettings = new Mock<ISettingsService<OmbiSettings>>();
|
var ombiSettings = new Mock<ISettingsService<OmbiSettings>>();
|
||||||
var requestSub = new Mock<IRepository<RequestSubscription>>();
|
var requestSub = new Mock<IRepository<RequestSubscription>>();
|
||||||
_musicApi = new Mock<IMusicBrainzApi>();
|
|
||||||
_lidarrSettings = new Mock<ISettingsService<LidarrSettings>>();
|
_lidarrSettings = new Mock<ISettingsService<LidarrSettings>>();
|
||||||
_lidarrApi = new Mock<ILidarrApi>();
|
_lidarrApi = new Mock<ILidarrApi>();
|
||||||
_lidarrSettings.Setup(x => x.GetSettingsAsync()).ReturnsAsync(new LidarrSettings());
|
_lidarrSettings.Setup(x => x.GetSettingsAsync()).ReturnsAsync(new LidarrSettings());
|
||||||
|
@ -61,109 +57,6 @@ namespace Ombi.Core.Tests.Engine.V2
|
||||||
_lidarrSettings.Object, _lidarrApi.Object);
|
_lidarrSettings.Object, _lidarrApi.Object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public async Task GetBasicArtistInformation_SingleArtist_Test()
|
|
||||||
{
|
|
||||||
_musicApi.Setup(x => x.GetArtistInformation("pretend-artist-id")).ReturnsAsync(F.Create<Artist>());
|
|
||||||
|
|
||||||
var result = await _engine.GetArtistInformation("pretend-artist-id");
|
|
||||||
|
|
||||||
Assert.That(result, Is.Not.Null);
|
|
||||||
Assert.That(result.ReleaseGroups.Any(), Is.True, "Release Groups are null");
|
|
||||||
Assert.That(result.Members.Any(), Is.False, "Members somehow populated?");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public async Task GetBasicArtistInformation_Group_Test()
|
|
||||||
{
|
|
||||||
var musicReturnVal = F.Build<Artist>().With(x => x.Relations, new List<Relation>
|
|
||||||
{
|
|
||||||
new Relation
|
|
||||||
{
|
|
||||||
TypeId = RelationLinks.BandMember,
|
|
||||||
Artist = new Artist
|
|
||||||
{
|
|
||||||
Name = "Mr Artist"
|
|
||||||
},
|
|
||||||
Attributes = new []{"a nobody"},
|
|
||||||
Begin = "1992",
|
|
||||||
End = "2019",
|
|
||||||
Ended = true
|
|
||||||
},
|
|
||||||
new Relation
|
|
||||||
{
|
|
||||||
TypeId = RelationLinks.BandMember,
|
|
||||||
Artist = new Artist
|
|
||||||
{
|
|
||||||
Name = "Mr Artist2"
|
|
||||||
},
|
|
||||||
Attributes = new []{"a nobody2"},
|
|
||||||
Begin = "1993",
|
|
||||||
}
|
|
||||||
});
|
|
||||||
_musicApi.Setup(x => x.GetArtistInformation("pretend-artist-id")).ReturnsAsync(musicReturnVal.Create());
|
|
||||||
|
|
||||||
var result = await _engine.GetArtistInformation("pretend-artist-id");
|
|
||||||
|
|
||||||
Assert.That(result, Is.Not.Null);
|
|
||||||
Assert.That(result.ReleaseGroups.Any(), Is.True, "Release Groups are null");
|
|
||||||
Assert.That(result.Members.Any(), Is.True, "Members IS NULL!");
|
|
||||||
|
|
||||||
Assert.That(result.Members.FirstOrDefault(x => x.Name == "Mr Artist").End, Is.EqualTo("2019"));
|
|
||||||
Assert.That(result.Members.FirstOrDefault(x => x.Name == "Mr Artist").Attributes.Length, Is.EqualTo(1));
|
|
||||||
Assert.That(result.Members.FirstOrDefault(x => x.Name == "Mr Artist").IsCurrentMember, Is.EqualTo(false));
|
|
||||||
Assert.That(result.Members.FirstOrDefault(x => x.Name == "Mr Artist").Start, Is.EqualTo("1992"));
|
|
||||||
|
|
||||||
Assert.That(result.Members.FirstOrDefault(x => x.Name == "Mr Artist2").IsCurrentMember, Is.EqualTo(true));
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestCaseSource(nameof(LinksData))]
|
|
||||||
public async Task<string> GetBasicArtistInformation_Links_Test(string url, string typeId, Func<ArtistInformation, string> func)
|
|
||||||
{
|
|
||||||
var musicReturnVal = F.Build<Artist>().With(x => x.Relations, new List<Relation>
|
|
||||||
{
|
|
||||||
new Relation
|
|
||||||
{
|
|
||||||
TypeId = typeId,
|
|
||||||
Url = new Url
|
|
||||||
{
|
|
||||||
Resource = url
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
});
|
|
||||||
_musicApi.Setup(x => x.GetArtistInformation("pretend-artist-id")).ReturnsAsync(musicReturnVal.Create());
|
|
||||||
|
|
||||||
var result = await _engine.GetArtistInformation("pretend-artist-id");
|
|
||||||
|
|
||||||
Assert.That(result, Is.Not.Null);
|
|
||||||
return func(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<TestCaseData> LinksData
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
yield return new TestCaseData("twitter.com", RelationLinks.SocialNetwork, new Func<ArtistInformation, string>(artist => artist.Links.Twitter)).Returns("twitter.com").SetName("ArtistInformation_Links_Twitter");
|
|
||||||
yield return new TestCaseData("allmusic", RelationLinks.AllMusic, new Func<ArtistInformation, string>(artist => artist.Links.AllMusic)).Returns("allmusic").SetName("ArtistInformation_Links_AllMusic");
|
|
||||||
yield return new TestCaseData("bbcmusic", RelationLinks.BbcMusic, new Func<ArtistInformation, string>(artist => artist.Links.BbcMusic)).Returns("bbcmusic").SetName("ArtistInformation_Links_BbcMusic");
|
|
||||||
yield return new TestCaseData("discogs", RelationLinks.Discogs, new Func<ArtistInformation, string>(artist => artist.Links.Discogs)).Returns("discogs").SetName("ArtistInformation_Links_Discogs");
|
|
||||||
yield return new TestCaseData("homepage", RelationLinks.Homepage, new Func<ArtistInformation, string>(artist => artist.Links.HomePage)).Returns("homepage").SetName("ArtistInformation_Links_Homepage");
|
|
||||||
yield return new TestCaseData("imdb", RelationLinks.Imdb, new Func<ArtistInformation, string>(artist => artist.Links.Imdb)).Returns("imdb").SetName("ArtistInformation_Links_Imdb");
|
|
||||||
yield return new TestCaseData("lastfm", RelationLinks.LastFm, new Func<ArtistInformation, string>(artist => artist.Links.LastFm)).Returns("lastfm").SetName("ArtistInformation_Links_LastFm");
|
|
||||||
yield return new TestCaseData("myspace", RelationLinks.MySpace, new Func<ArtistInformation, string>(artist => artist.Links.MySpace)).Returns("myspace").SetName("ArtistInformation_Links_MySpace");
|
|
||||||
yield return new TestCaseData("onlinecommunity", RelationLinks.OnlineCommunity, new Func<ArtistInformation, string>(artist => artist.Links.OnlineCommunity)).Returns("onlinecommunity").SetName("ArtistInformation_Links_OnlineCommunity");
|
|
||||||
yield return new TestCaseData("www.facebook.com", RelationLinks.SocialNetwork, new Func<ArtistInformation, string>(artist => artist.Links.Facebook)).Returns("www.facebook.com").SetName("ArtistInformation_Links_Facebook");
|
|
||||||
yield return new TestCaseData("www.instagram.com", RelationLinks.SocialNetwork, new Func<ArtistInformation, string>(artist => artist.Links.Instagram)).Returns("www.instagram.com").SetName("ArtistInformation_Links_insta");
|
|
||||||
yield return new TestCaseData("www.vk.com", RelationLinks.SocialNetwork, new Func<ArtistInformation, string>(artist => artist.Links.Vk)).Returns("www.vk.com").SetName("ArtistInformation_Links_vk");
|
|
||||||
yield return new TestCaseData("app.spotify.com", RelationLinks.Streams, new Func<ArtistInformation, string>(artist => artist.Links.Spotify)).Returns("app.spotify.com").SetName("ArtistInformation_Links_Spotify");
|
|
||||||
yield return new TestCaseData("deezer.com", RelationLinks.Streams, new Func<ArtistInformation, string>(artist => artist.Links.Deezer)).Returns("deezer.com").SetName("ArtistInformation_Links_Deezer");
|
|
||||||
yield return new TestCaseData("play.google.com", RelationLinks.Download, new Func<ArtistInformation, string>(artist => artist.Links.Google)).Returns("play.google.com").SetName("ArtistInformation_Links_Google");
|
|
||||||
yield return new TestCaseData("itunes.apple.com", RelationLinks.Download, new Func<ArtistInformation, string>(artist => artist.Links.Apple)).Returns("itunes.apple.com").SetName("ArtistInformation_Links_Apple");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public async Task GetArtistInformation_WithPosters()
|
public async Task GetArtistInformation_WithPosters()
|
||||||
{
|
{
|
||||||
|
@ -200,7 +93,6 @@ namespace Ombi.Core.Tests.Engine.V2
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_musicApi.Setup(x => x.GetArtistInformation("pretend-artist-id")).ReturnsAsync(F.Create<Artist>());
|
|
||||||
|
|
||||||
var result = await _engine.GetArtistInformation("pretend-artist-id");
|
var result = await _engine.GetArtistInformation("pretend-artist-id");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue