mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
Added naming integration tests
This commit is contained in:
parent
2e694485fe
commit
fbf91fe8f5
@ -87,6 +87,13 @@ public List<dynamic> InvalidPost(TResource body)
|
|||||||
return Post<List<dynamic>>(request, HttpStatusCode.BadRequest);
|
return Post<List<dynamic>>(request, HttpStatusCode.BadRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<dynamic> InvalidPut(TResource body)
|
||||||
|
{
|
||||||
|
var request = BuildRequest();
|
||||||
|
request.AddBody(body);
|
||||||
|
return Put<List<dynamic>>(request, HttpStatusCode.BadRequest);
|
||||||
|
}
|
||||||
|
|
||||||
public RestRequest BuildRequest(string command = "")
|
public RestRequest BuildRequest(string command = "")
|
||||||
{
|
{
|
||||||
var request = new RestRequest(_resource + "/" + command.Trim('/'))
|
var request = new RestRequest(_resource + "/" + command.Trim('/'))
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
using FluentAssertions;
|
using System.Net;
|
||||||
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Api.Config;
|
||||||
|
|
||||||
namespace NzbDrone.Integration.Test
|
namespace NzbDrone.Integration.Test
|
||||||
{
|
{
|
||||||
@ -34,5 +36,41 @@ public void should_be_able_to_update()
|
|||||||
result.StandardEpisodeFormat.Should().Be(config.StandardEpisodeFormat);
|
result.StandardEpisodeFormat.Should().Be(config.StandardEpisodeFormat);
|
||||||
result.DailyEpisodeFormat.Should().Be(config.DailyEpisodeFormat);
|
result.DailyEpisodeFormat.Should().Be(config.DailyEpisodeFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_get_bad_request_if_standard_format_is_empty()
|
||||||
|
{
|
||||||
|
var config = NamingConfig.GetSingle();
|
||||||
|
config.RenameEpisodes = false;
|
||||||
|
config.StandardEpisodeFormat = "";
|
||||||
|
config.DailyEpisodeFormat = "{Series Title} - {Air-Date} - {Episode Title}";
|
||||||
|
|
||||||
|
var errors = NamingConfig.InvalidPut(config);
|
||||||
|
errors.Should().NotBeEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_get_bad_request_if_standard_format_doesnt_contain_season_and_episode()
|
||||||
|
{
|
||||||
|
var config = NamingConfig.GetSingle();
|
||||||
|
config.RenameEpisodes = false;
|
||||||
|
config.StandardEpisodeFormat = "{season}";
|
||||||
|
config.DailyEpisodeFormat = "{Series Title} - {Air-Date} - {Episode Title}";
|
||||||
|
|
||||||
|
var errors = NamingConfig.InvalidPut(config);
|
||||||
|
errors.Should().NotBeEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_get_bad_request_if_daily_format_doesnt_contain_season_and_episode_or_air_date()
|
||||||
|
{
|
||||||
|
var config = NamingConfig.GetSingle();
|
||||||
|
config.RenameEpisodes = false;
|
||||||
|
config.StandardEpisodeFormat = "{Series Title} - {season}x{episode:00} - {Episode Title}";
|
||||||
|
config.DailyEpisodeFormat = "{Series Title} - {season} - {Episode Title}";
|
||||||
|
|
||||||
|
var errors = NamingConfig.InvalidPut(config);
|
||||||
|
errors.Should().NotBeEmpty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user