You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.2 KiB
35 lines
1.2 KiB
using System;
|
|
using System.Linq;
|
|
using FluentAssertions;
|
|
using NUnit.Framework;
|
|
|
|
namespace NzbDrone.Integration.Test
|
|
{
|
|
[TestFixture]
|
|
public class HttpLogFixture : IntegrationTest
|
|
{
|
|
[Test]
|
|
public void should_log_on_error()
|
|
{
|
|
var config = HostConfig.Get(1);
|
|
config.LogLevel = "Trace";
|
|
HostConfig.Put(config);
|
|
|
|
var resultGet = Author.All();
|
|
|
|
var logFile = "Readarr.trace.txt";
|
|
var logLines = Logs.GetLogFileLines(logFile);
|
|
|
|
var result = Author.InvalidPost(new Readarr.Api.V1.Author.AuthorResource());
|
|
|
|
// Skip 2 and 1 to ignore the logs endpoint
|
|
logLines = Logs.GetLogFileLines(logFile).Skip(logLines.Length + 2).ToArray();
|
|
Array.Resize(ref logLines, logLines.Length - 1);
|
|
|
|
logLines.Should().Contain(v => v.Contains("|Trace|Http|Req") && v.Contains("/api/v1/author/"));
|
|
logLines.Should().Contain(v => v.Contains("|Trace|Http|Res") && v.Contains("/api/v1/author/: 400.BadRequest"));
|
|
logLines.Should().Contain(v => v.Contains("|Debug|Api|") && v.Contains("/api/v1/author/: 400.BadRequest"));
|
|
}
|
|
}
|
|
}
|