Fixed some petapoco issue with insert.

pull/4/head
kay.one 13 years ago
parent 5a4e8330b2
commit 861026f743

@ -145,7 +145,7 @@
<virtualDirectory path="/" physicalPath="%NZBDRONE_PATH%\NZBDrone.Web" /> <virtualDirectory path="/" physicalPath="%NZBDRONE_PATH%\NZBDrone.Web" />
</application> </application>
<bindings> <bindings>
<binding protocol="http" bindingInformation="*:8980:" /> <binding protocol="http" bindingInformation="*:8989:" />
</bindings> </bindings>
</site> </site>
<applicationDefaults applicationPool="IISExpressAppPool" /> <applicationDefaults applicationPool="IISExpressAppPool" />

@ -60,26 +60,6 @@ namespace NzbDrone.Core.Test
} }
[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] [Test]
public void RemoveRootDir() public void RemoveRootDir()
{ {
@ -152,14 +132,5 @@ namespace NzbDrone.Core.Test
mocker.Resolve<RootDirProvider>().Add(new RootDir { Id = 0, Path = 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 @@ namespace PetaPoco
Oracle, Oracle,
SQLite SQLite
} }
DBType _dbType = DBType.SqlServer; DBType _dbType = DBType.SqlServerCE;
// Common initialization // Common initialization
private void CommonConstruct() private void CommonConstruct()

@ -42,13 +42,6 @@ namespace NzbDrone.Core.Providers
_database.Delete<RootDir>(rootDirId); _database.Delete<RootDir>(rootDirId);
} }
public virtual void Update(RootDir rootDir)
{
ValidatePath(rootDir);
_database.Update(rootDir);
}
private static void ValidatePath(RootDir rootDir) private static void ValidatePath(RootDir rootDir)
{ {
if (String.IsNullOrWhiteSpace(rootDir.Path) || !Path.IsPathRooted(rootDir.Path)) if (String.IsNullOrWhiteSpace(rootDir.Path) || !Path.IsPathRooted(rootDir.Path))

@ -269,37 +269,7 @@ namespace NzbDrone.Web.Controllers
} }
} }
[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] [HttpPost]
public ActionResult SaveIndexers(IndexerSettingsModel data) public ActionResult SaveIndexers(IndexerSettingsModel data)
{ {

@ -4,6 +4,6 @@
<supportedRuntime version="v4.0" /> <supportedRuntime version="v4.0" />
</startup> </startup>
<appSettings> <appSettings>
<add key="port" value="8980" /> <add key="port" value="8989" />
</appSettings> </appSettings>
</configuration> </configuration>
Loading…
Cancel
Save