mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-10 11:10:40 +02:00
Fixed some petapoco issue with insert.
This commit is contained in:
parent
5a4e8330b2
commit
861026f743
@ -145,7 +145,7 @@
|
||||
<virtualDirectory path="/" physicalPath="%NZBDRONE_PATH%\NZBDrone.Web" />
|
||||
</application>
|
||||
<bindings>
|
||||
<binding protocol="http" bindingInformation="*:8980:" />
|
||||
<binding protocol="http" bindingInformation="*:8989:" />
|
||||
</bindings>
|
||||
</site>
|
||||
<applicationDefaults applicationPool="IISExpressAppPool" />
|
||||
|
@ -60,26 +60,6 @@ public void AddRootDir(string path)
|
||||
}
|
||||
|
||||
|
||||
[TestCase("D:\\TV Shows\\")]
|
||||
[TestCase("//server//folder")]
|
||||
public void UpdateRootDir(string newPath)
|
||||
{
|
||||
//Setup
|
||||
var mocker = new AutoMoqer();
|
||||
mocker.SetConstant(MockLib.GetEmptyDatabase());
|
||||
|
||||
|
||||
//Act
|
||||
var rootDirProvider = mocker.Resolve<RootDirProvider>();
|
||||
rootDirProvider.Add(new RootDir { Path = @"C:\TV" });
|
||||
rootDirProvider.Update(new RootDir { Id = 1, Path = newPath });
|
||||
|
||||
//Assert
|
||||
var rootDirs = rootDirProvider.GetAll();
|
||||
rootDirs.Should().HaveCount(1);
|
||||
newPath.Should().Be(rootDirs.First().Path);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RemoveRootDir()
|
||||
{
|
||||
@ -152,14 +132,5 @@ public void invalid_folder_path_throws_on_add(string path)
|
||||
mocker.Resolve<RootDirProvider>().Add(new RootDir { Id = 0, Path = path });
|
||||
}
|
||||
|
||||
[TestCase("")]
|
||||
[TestCase(null)]
|
||||
[TestCase("BAD PATH")]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void invalid_folder_path_throws_on_update(string path)
|
||||
{
|
||||
var mocker = new AutoMoqer();
|
||||
mocker.Resolve<RootDirProvider>().Update(new RootDir { Id = 2, Path = path });
|
||||
}
|
||||
}
|
||||
}
|
@ -329,7 +329,7 @@ enum DBType
|
||||
Oracle,
|
||||
SQLite
|
||||
}
|
||||
DBType _dbType = DBType.SqlServer;
|
||||
DBType _dbType = DBType.SqlServerCE;
|
||||
|
||||
// Common initialization
|
||||
private void CommonConstruct()
|
||||
|
@ -42,13 +42,6 @@ public virtual void Remove(int rootDirId)
|
||||
_database.Delete<RootDir>(rootDirId);
|
||||
}
|
||||
|
||||
public virtual void Update(RootDir rootDir)
|
||||
{
|
||||
ValidatePath(rootDir);
|
||||
|
||||
_database.Update(rootDir);
|
||||
}
|
||||
|
||||
private static void ValidatePath(RootDir rootDir)
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(rootDir.Path) || !Path.IsPathRooted(rootDir.Path))
|
||||
|
@ -269,36 +269,6 @@ public JsonResult AutoConfigureSab()
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult SaveGeneral(SettingsModel data)
|
||||
{
|
||||
var basicNotification = new BasicNotification();
|
||||
basicNotification.Type = BasicNotificationType.Info;
|
||||
basicNotification.AutoDismiss = true;
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var dir in data.Directories)
|
||||
{
|
||||
_rootDirProvider.Update(dir);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Debug("Failed to save Root Dirs");
|
||||
Logger.DebugException(ex.Message, ex);
|
||||
|
||||
basicNotification.Title = SETTINGS_FAILED;
|
||||
_notificationProvider.Register(basicNotification);
|
||||
return Content(SETTINGS_FAILED);
|
||||
}
|
||||
|
||||
|
||||
basicNotification.Title = SETTINGS_SAVED;
|
||||
_notificationProvider.Register(basicNotification);
|
||||
|
||||
return Content(SETTINGS_SAVED);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult SaveIndexers(IndexerSettingsModel data)
|
||||
|
@ -4,6 +4,6 @@
|
||||
<supportedRuntime version="v4.0" />
|
||||
</startup>
|
||||
<appSettings>
|
||||
<add key="port" value="8980" />
|
||||
<add key="port" value="8989" />
|
||||
</appSettings>
|
||||
</configuration>
|
Loading…
Reference in New Issue
Block a user