tidusjar 8 years ago
commit 8df742abe3

@ -42,6 +42,7 @@ using PlexRequests.Services.Interfaces;
using PlexRequests.Helpers; using PlexRequests.Helpers;
using PlexRequests.Services.Jobs; using PlexRequests.Services.Jobs;
using PlexRequests.Services.Models; using PlexRequests.Services.Models;
using PlexRequests.Services.Notification;
using PlexRequests.Store.Models; using PlexRequests.Store.Models;
using PlexRequests.Store.Repository; using PlexRequests.Store.Repository;
@ -63,6 +64,11 @@ namespace PlexRequests.Services.Tests
private Mock<IJobRecord> JobRec { get; set; } private Mock<IJobRecord> JobRec { get; set; }
private Mock<IRepository<UsersToNotify>> NotifyUsers { get; set; } private Mock<IRepository<UsersToNotify>> NotifyUsers { get; set; }
private Mock<IRepository<PlexEpisodes>> PlexEpisodes { get; set; } private Mock<IRepository<PlexEpisodes>> PlexEpisodes { get; set; }
private Mock<INotificationEngine> Engine
{
get;
set;
}
[SetUp] [SetUp]
public void Setup() public void Setup()
@ -76,7 +82,8 @@ namespace PlexRequests.Services.Tests
NotifyUsers = new Mock<IRepository<UsersToNotify>>(); NotifyUsers = new Mock<IRepository<UsersToNotify>>();
PlexEpisodes = new Mock<IRepository<PlexEpisodes>>(); PlexEpisodes = new Mock<IRepository<PlexEpisodes>>();
JobRec = new Mock<IJobRecord>(); JobRec = new Mock<IJobRecord>();
Checker = new PlexAvailabilityChecker(SettingsMock.Object, RequestMock.Object, PlexMock.Object, CacheMock.Object, NotificationMock.Object, JobRec.Object, NotifyUsers.Object, PlexEpisodes.Object); Engine = new Mock<INotificationEngine>();
Checker = new PlexAvailabilityChecker(SettingsMock.Object, RequestMock.Object, PlexMock.Object, CacheMock.Object, NotificationMock.Object, JobRec.Object, NotifyUsers.Object, PlexEpisodes.Object, Engine.Object);
} }
@ -212,8 +219,7 @@ namespace PlexRequests.Services.Tests
new PlexEpisodes {EpisodeNumber = 1, ShowTitle = "The Flash",ProviderId = 23.ToString(), SeasonNumber = 1, EpisodeTitle = "Pilot"} new PlexEpisodes {EpisodeNumber = 1, ShowTitle = "The Flash",ProviderId = 23.ToString(), SeasonNumber = 1, EpisodeTitle = "Pilot"}
}; };
PlexEpisodes.Setup(x => x.Custom(It.IsAny<Func<IDbConnection, IEnumerable<PlexEpisodes>>>())).Returns(expected); PlexEpisodes.Setup(x => x.Custom(It.IsAny<Func<IDbConnection, IEnumerable<PlexEpisodes>>>())).Returns(expected);
Checker = new PlexAvailabilityChecker(SettingsMock.Object, RequestMock.Object, PlexMock.Object, CacheMock.Object, NotificationMock.Object, JobRec.Object, NotifyUsers.Object, PlexEpisodes.Object);
var result = Checker.IsEpisodeAvailable(providerId, season, episode); var result = Checker.IsEpisodeAvailable(providerId, season, episode);
return result; return result;
@ -270,8 +276,6 @@ namespace PlexRequests.Services.Tests
public async Task GetAllPlexEpisodes() public async Task GetAllPlexEpisodes()
{ {
PlexEpisodes.Setup(x => x.GetAllAsync()).ReturnsAsync(F.CreateMany<PlexEpisodes>().ToList()); PlexEpisodes.Setup(x => x.GetAllAsync()).ReturnsAsync(F.CreateMany<PlexEpisodes>().ToList());
Checker = new PlexAvailabilityChecker(SettingsMock.Object, RequestMock.Object, PlexMock.Object, CacheMock.Object, NotificationMock.Object, JobRec.Object, NotifyUsers.Object, PlexEpisodes.Object);
var episodes = await Checker.GetEpisodes(); var episodes = await Checker.GetEpisodes();
Assert.That(episodes.Count(), Is.GreaterThan(0)); Assert.That(episodes.Count(), Is.GreaterThan(0));

@ -193,7 +193,7 @@ namespace PlexRequests.Services.Notification
{ {
client.Authenticate(settings.EmailUsername, settings.EmailPassword); client.Authenticate(settings.EmailUsername, settings.EmailPassword);
} }
Log.Info("sending message to {0} \r\n from: {1}\r\n Are we authenticated: {2}", message.To, message.From, client.IsAuthenticated);
await client.SendAsync(message); await client.SendAsync(message);
await client.DisconnectAsync(true); await client.DisconnectAsync(true);
} }

@ -578,7 +578,7 @@ function tvLoad() {
results.forEach(function (result) { results.forEach(function (result) {
var ep = result.episodes; var ep = result.episodes;
ep.forEach(function (episode) { ep.forEach(function (episode) {
var foundItem = tvObject.find(x => x.seasonNumber === episode.seasonNumber); var foundItem = tvObject.find(function(x) { return x.seasonNumber === episode.seasonNumber });
if (!foundItem) { if (!foundItem) {
var obj = { seasonNumber: episode.seasonNumber, episodes: [] } var obj = { seasonNumber: episode.seasonNumber, episodes: [] }
tvObject.push(obj); tvObject.push(obj);

@ -92,7 +92,7 @@ $(function () {
if (searchTimer) { if (searchTimer) {
clearTimeout(searchTimer); clearTimeout(searchTimer);
} }
searchTimer = setTimeout(function() { searchTimer = setTimeout(function () {
tvSearch(); tvSearch();
}.bind(this), 800); }.bind(this), 800);
}); });
@ -508,7 +508,7 @@ $(function () {
var $content = $("#seasonsBody"); var $content = $("#seasonsBody");
$content.html(""); $content.html("");
$('#selectedSeasonsId').val(id); $('#selectedSeasonsId').val(id);
results.forEach(function(result) { results.forEach(function (result) {
var context = buildSeasonsContext(result); var context = buildSeasonsContext(result);
$content.append(seasonsTemplate(context)); $content.append(seasonsTemplate(context));
}); });
@ -527,7 +527,7 @@ $(function () {
}; };
}); });
$('#seasonsRequest').click(function(e) { $('#seasonsRequest').click(function (e) {
e.preventDefault(); e.preventDefault();
var tvId = $('#selectedSeasonsId').val(); var tvId = $('#selectedSeasonsId').val();
var url = createBaseUrl(base, '/search/seasons/'); var url = createBaseUrl(base, '/search/seasons/');
@ -546,7 +546,7 @@ $(function () {
var $checkedSeasons = $('.selectedSeasons:checkbox:checked'); var $checkedSeasons = $('.selectedSeasons:checkbox:checked');
$checkedSeasons.each(function (index, element) { $checkedSeasons.each(function (index, element) {
if (index < $checkedSeasons.length -1) { if (index < $checkedSeasons.length - 1) {
seasonsParam = seasonsParam + element.id + ","; seasonsParam = seasonsParam + element.id + ",";
} else { } else {
seasonsParam = seasonsParam + element.id; seasonsParam = seasonsParam + element.id;
@ -560,7 +560,7 @@ $(function () {
var url = $form.prop('action'); var url = $form.prop('action');
sendRequestAjax(data, type, url, tvId); sendRequestAjax(data, type, url, tvId);
}); });
$('#episodesModal').on('show.bs.modal', function (event) { $('#episodesModal').on('show.bs.modal', function (event) {
@ -584,7 +584,9 @@ $(function () {
results.forEach(function (result) { results.forEach(function (result) {
var episodes = buildEpisodesView(result); var episodes = buildEpisodesView(result);
if (!seenSeasons.find(x => x === episodes.season)) { if (!seenSeasons.find(function(x) {
return x === episodes.season
})) {
// Create the seasons heading // Create the seasons heading
seenSeasons.push(episodes.season); seenSeasons.push(episodes.season);
var context = buildSeasonsCount(result); var context = buildSeasonsCount(result);
@ -610,7 +612,7 @@ $(function () {
loadingButton("episodesRequest", "primary"); loadingButton("episodesRequest", "primary");
var tvId = $('#selectedEpisodeId').val(); var tvId = $('#selectedEpisodeId').val();
var $form = $('#form' + tvId); var $form = $('#form' + tvId);
var model = []; var model = [];
@ -647,7 +649,7 @@ $(function () {
} }
}, },
error: function(e) { error: function (e) {
console.log(e); console.log(e);
generateNotify("Something went wrong!", "danger"); generateNotify("Something went wrong!", "danger");
} }

@ -3,9 +3,9 @@ configuration: Release
assembly_info: assembly_info:
patch: true patch: true
file: '**\AssemblyInfo.*' file: '**\AssemblyInfo.*'
assembly_version: '1.9.0' assembly_version: '1.9.1'
assembly_file_version: '{version}' assembly_file_version: '{version}'
assembly_informational_version: '1.9.0' assembly_informational_version: '1.9.1'
before_build: before_build:
- cmd: appveyor-retry nuget restore - cmd: appveyor-retry nuget restore
build: build:

Loading…
Cancel
Save