diff --git a/NzbDrone.Common/ReportingService.cs b/NzbDrone.Common/ReportingService.cs index 0ab413e17..7faf928b2 100644 --- a/NzbDrone.Common/ReportingService.cs +++ b/NzbDrone.Common/ReportingService.cs @@ -10,7 +10,7 @@ public static class ReportingService { private static readonly Logger logger = LogManager.GetCurrentClassLogger(); - private const string SERVICE_URL = "http://services.nzbdrone.com/reporting"; + private const string SERVICE_URL = "http://stage.services.nzbdrone.com/reporting"; private const string PARSE_URL = SERVICE_URL + "/ParseError"; private const string EXCEPTION_URL = SERVICE_URL + "/ReportException"; diff --git a/NzbDrone.Services/NzbDrone.Services.Service/Controllers/ExceptionController.cs b/NzbDrone.Services/NzbDrone.Services.Service/Controllers/ExceptionController.cs index 11c119b60..725b68eb2 100644 --- a/NzbDrone.Services/NzbDrone.Services.Service/Controllers/ExceptionController.cs +++ b/NzbDrone.Services/NzbDrone.Services.Service/Controllers/ExceptionController.cs @@ -2,6 +2,7 @@ using System.Linq; using System.Web.Mvc; using NLog; +using Ninject; using NzbDrone.Common.Contract; using NzbDrone.Services.Service.Repository.Reporting; using Services.PetaPoco; @@ -13,6 +14,7 @@ public class ExceptionController : Controller private readonly IDatabase _database; private static readonly Logger logger = LogManager.GetCurrentClassLogger(); + [Inject] public ExceptionController(IDatabase database) { _database = database; diff --git a/NzbDrone.Services/NzbDrone.Services.Tests/ExceptionController/ReportExistingFixture.cs b/NzbDrone.Services/NzbDrone.Services.Tests/ExceptionControllerTests/ReportExistingFixture.cs similarity index 96% rename from NzbDrone.Services/NzbDrone.Services.Tests/ExceptionController/ReportExistingFixture.cs rename to NzbDrone.Services/NzbDrone.Services.Tests/ExceptionControllerTests/ReportExistingFixture.cs index 00e92b737..fe16b03f3 100644 --- a/NzbDrone.Services/NzbDrone.Services.Tests/ExceptionController/ReportExistingFixture.cs +++ b/NzbDrone.Services/NzbDrone.Services.Tests/ExceptionControllerTests/ReportExistingFixture.cs @@ -8,7 +8,7 @@ using NzbDrone.Services.Tests.Framework; using NzbDrone.Test.Common; -namespace NzbDrone.Services.Tests.ExceptionController +namespace NzbDrone.Services.Tests.ExceptionControllerTests { [TestFixture] public class ReportExistingFixture : ServicesTestBase diff --git a/NzbDrone.Services/NzbDrone.Services.Tests/ExceptionController/ReportNewFixture.cs b/NzbDrone.Services/NzbDrone.Services.Tests/ExceptionControllerTests/ReportNewFixture.cs similarity index 99% rename from NzbDrone.Services/NzbDrone.Services.Tests/ExceptionController/ReportNewFixture.cs rename to NzbDrone.Services/NzbDrone.Services.Tests/ExceptionControllerTests/ReportNewFixture.cs index 1d872d6aa..a2658b0ef 100644 --- a/NzbDrone.Services/NzbDrone.Services.Tests/ExceptionController/ReportNewFixture.cs +++ b/NzbDrone.Services/NzbDrone.Services.Tests/ExceptionControllerTests/ReportNewFixture.cs @@ -6,7 +6,7 @@ using NzbDrone.Services.Service.Repository.Reporting; using NzbDrone.Services.Tests.Framework; -namespace NzbDrone.Services.Tests.ExceptionController +namespace NzbDrone.Services.Tests.ExceptionControllerTests { [TestFixture] public class ReportNewFixture : ServicesTestBase diff --git a/NzbDrone.Services/NzbDrone.Services.Tests/NzbDrone.Services.Tests.csproj b/NzbDrone.Services/NzbDrone.Services.Tests/NzbDrone.Services.Tests.csproj index 11bf63b31..7f757d47d 100644 --- a/NzbDrone.Services/NzbDrone.Services.Tests/NzbDrone.Services.Tests.csproj +++ b/NzbDrone.Services/NzbDrone.Services.Tests/NzbDrone.Services.Tests.csproj @@ -68,8 +68,8 @@ - - + + diff --git a/NzbDrone.Services/NzbDrone.Services.Tests/ReportingControllerFixture.cs b/NzbDrone.Services/NzbDrone.Services.Tests/ReportingControllerFixture.cs index c8da31737..62896b43c 100644 --- a/NzbDrone.Services/NzbDrone.Services.Tests/ReportingControllerFixture.cs +++ b/NzbDrone.Services/NzbDrone.Services.Tests/ReportingControllerFixture.cs @@ -12,6 +12,12 @@ namespace NzbDrone.Services.Tests [TestFixture] public class ReportingControllerFixture : ServicesTestBase { + [SetUp] + public void Setup() + { + WithRealDb(); + Mocker.Resolve(); + } ReportingController Controller { @@ -94,7 +100,6 @@ public void parse_report_should_be_saved() { var parseReport = CreateParseErrorReport(); - WithRealDb(); Controller.ParseError(parseReport); @@ -115,7 +120,6 @@ public void parse_report_should_save_report_if_title_doesnt_exist() parseReport1.Title = Guid.NewGuid().ToString(); - WithRealDb(); Controller.ParseError(parseReport1); Controller.ParseError(parseReport2); @@ -130,7 +134,6 @@ public void parse_report_should_not_save_report_if_title_exist() var parseReport1 = CreateParseErrorReport(); var parseReport2 = CreateParseErrorReport(); - WithRealDb(); Controller.ParseError(parseReport1); Controller.ParseError(parseReport2); @@ -138,27 +141,5 @@ public void parse_report_should_not_save_report_if_title_exist() var reports = Db.Fetch(); reports.Should().HaveCount(1); } - - [Test] - public void exception_report_should_be_saved() - { - var exceptionReport = CreateExceptionReport(); - - WithRealDb(); - - Controller.ReportException(exceptionReport); - - var exceptionRows = Db.Fetch(); - exceptionRows.Should().HaveCount(1); - exceptionRows.Single().IsProduction.Should().Be(exceptionReport.IsProduction); - exceptionRows.Single().Version.Should().Be(exceptionReport.Version); - exceptionRows.Single().Timestamp.Should().BeWithin(TimeSpan.FromSeconds(4)).Before(DateTime.Now); - exceptionRows.Single().UGuid.Should().Be(exceptionReport.UGuid); - - exceptionRows.Single().Logger.Should().Be(exceptionReport.Logger); - exceptionRows.Single().LogMessage.Should().Be(exceptionReport.LogMessage); - exceptionRows.Single().String.Should().Be(exceptionReport.String); - exceptionRows.Single().Type.Should().Be(exceptionReport.Type); - } } }