2013-08-26 19:35:53 +00:00
|
|
|
|
using System;
|
2013-04-22 03:18:08 +00:00
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using NUnit.Framework;
|
2019-09-03 02:22:25 +00:00
|
|
|
|
using Radarr.Api.V2.RootFolders;
|
2013-04-22 03:18:08 +00:00
|
|
|
|
|
2016-04-04 17:40:51 +00:00
|
|
|
|
namespace NzbDrone.Integration.Test.ApiTests
|
2013-04-22 03:18:08 +00:00
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2016-04-04 17:40:51 +00:00
|
|
|
|
public class RootFolderFixture : IntegrationTest
|
2013-04-22 03:18:08 +00:00
|
|
|
|
{
|
2013-11-13 20:08:37 +00:00
|
|
|
|
[Test]
|
|
|
|
|
public void should_have_no_root_folder_initially()
|
2013-08-18 22:19:55 +00:00
|
|
|
|
{
|
2013-11-13 20:08:37 +00:00
|
|
|
|
RootFolders.All().Should().BeEmpty();
|
2013-08-18 22:19:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-22 03:18:08 +00:00
|
|
|
|
[Test]
|
2015-06-03 19:52:47 +00:00
|
|
|
|
[Ignore("SignalR on CI seems unstable")]
|
2013-11-13 20:08:37 +00:00
|
|
|
|
public void should_add_and_delete_root_folders()
|
2013-04-22 03:18:08 +00:00
|
|
|
|
{
|
2019-10-14 20:21:00 +00:00
|
|
|
|
ConnectSignalR().Wait();
|
2013-04-22 03:18:08 +00:00
|
|
|
|
|
|
|
|
|
var rootFolder = new RootFolderResource
|
2013-11-13 20:08:37 +00:00
|
|
|
|
{
|
|
|
|
|
Path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
|
|
|
|
|
};
|
2013-04-22 03:18:08 +00:00
|
|
|
|
|
|
|
|
|
var postResponse = RootFolders.Post(rootFolder);
|
|
|
|
|
|
|
|
|
|
postResponse.Id.Should().NotBe(0);
|
|
|
|
|
postResponse.FreeSpace.Should().NotBe(0);
|
|
|
|
|
|
|
|
|
|
RootFolders.All().Should().OnlyContain(c => c.Id == postResponse.Id);
|
|
|
|
|
|
|
|
|
|
|
2013-04-24 01:56:00 +00:00
|
|
|
|
RootFolders.Delete(postResponse.Id);
|
|
|
|
|
|
|
|
|
|
RootFolders.All().Should().BeEmpty();
|
2013-11-13 20:08:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SignalRMessages.Should().Contain(c => c.Name == "rootfolder");
|
2013-04-24 01:56:00 +00:00
|
|
|
|
}
|
2013-08-31 20:31:58 +00:00
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void invalid_path_should_return_bad_request()
|
|
|
|
|
{
|
2019-10-14 20:20:59 +00:00
|
|
|
|
IgnoreOnMonoVersions("5.12", "5.14");
|
|
|
|
|
|
2013-08-31 20:31:58 +00:00
|
|
|
|
var rootFolder = new RootFolderResource
|
|
|
|
|
{
|
|
|
|
|
Path = "invalid_path"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var postResponse = RootFolders.InvalidPost(rootFolder);
|
2016-03-25 00:56:29 +00:00
|
|
|
|
postResponse.Should().NotBeNull();
|
2013-08-31 20:31:58 +00:00
|
|
|
|
}
|
2013-04-22 03:18:08 +00:00
|
|
|
|
}
|
2019-10-14 20:21:00 +00:00
|
|
|
|
}
|