2013-09-11 06:33:47 +00:00
|
|
|
using System;
|
2013-04-15 01:41:39 +00:00
|
|
|
using FluentAssertions;
|
|
|
|
using NUnit.Framework;
|
2014-09-11 23:49:41 +00:00
|
|
|
using NzbDrone.Common;
|
2013-04-15 01:41:39 +00:00
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
using NzbDrone.Core.Update;
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test.UpdateTests
|
|
|
|
{
|
|
|
|
public class UpdatePackageProviderFixture : CoreTest<UpdatePackageProvider>
|
|
|
|
{
|
2013-04-16 00:08:06 +00:00
|
|
|
[Test]
|
2013-09-11 06:33:47 +00:00
|
|
|
public void no_update_when_version_higher()
|
2013-04-16 00:08:06 +00:00
|
|
|
{
|
|
|
|
UseRealHttp();
|
2014-09-11 23:49:41 +00:00
|
|
|
Subject.GetLatestUpdate("master", new Version(10, 0)).Should().BeNull();
|
2013-09-11 06:33:47 +00:00
|
|
|
}
|
2013-04-15 01:41:39 +00:00
|
|
|
|
2013-09-11 06:33:47 +00:00
|
|
|
[Test]
|
|
|
|
public void finds_update_when_version_lower()
|
|
|
|
{
|
|
|
|
UseRealHttp();
|
2014-03-08 03:18:56 +00:00
|
|
|
Subject.GetLatestUpdate("master", new Version(2, 0)).Should().NotBeNull();
|
2013-04-16 00:08:06 +00:00
|
|
|
}
|
2014-09-11 23:49:41 +00:00
|
|
|
|
2014-10-28 23:48:37 +00:00
|
|
|
[Test]
|
|
|
|
public void should_get_master_if_branch_doesnt_exit()
|
|
|
|
{
|
|
|
|
UseRealHttp();
|
2014-10-29 00:08:07 +00:00
|
|
|
Subject.GetLatestUpdate("invalid_branch", new Version(2, 0)).Should().NotBeNull();
|
2014-10-28 23:48:37 +00:00
|
|
|
}
|
|
|
|
|
2014-09-11 23:49:41 +00:00
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void should_get_recent_updates()
|
|
|
|
{
|
|
|
|
const string branch = "master";
|
|
|
|
UseRealHttp();
|
2014-10-13 21:11:35 +00:00
|
|
|
var recent = Subject.GetRecentUpdates(branch);
|
2014-09-11 23:49:41 +00:00
|
|
|
|
|
|
|
recent.Should().NotBeEmpty();
|
|
|
|
recent.Should().OnlyContain(c => c.Hash.IsNotNullOrWhiteSpace());
|
|
|
|
recent.Should().OnlyContain(c => c.FileName.Contains("Drone.master.2"));
|
|
|
|
recent.Should().OnlyContain(c => c.ReleaseDate.Year == 2014);
|
|
|
|
recent.Should().OnlyContain(c => c.Changes.New != null);
|
|
|
|
recent.Should().OnlyContain(c => c.Changes.Fixed != null);
|
2014-10-28 23:48:37 +00:00
|
|
|
recent.Should().OnlyContain(c => c.Branch == branch);
|
2014-09-11 23:49:41 +00:00
|
|
|
}
|
2013-04-15 01:41:39 +00:00
|
|
|
}
|
|
|
|
}
|