mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
* Core: Categories are stored in a real tree * Sorting: First Torznab categories sorted by Id and then custom cats sorted by Name * Filtering: Results with child category are not removed when searching by parent category. Details in #8049 * Jacket UI: Add parent category when at least one child category exists * Torznab (caps): Remove non existent children categories. Remove duplicated categories. Details in #10006
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Jackett.Common.Models;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Jackett.Test.TestHelpers
|
||||
{
|
||||
@@ -11,12 +13,24 @@ namespace Jackett.Test.TestHelpers
|
||||
// - with and without description
|
||||
// - parent and child categories
|
||||
// - custom categories are not added automatically but they are created from other categories automatically
|
||||
// - categories and subcategories are unsorted to test the sort when required
|
||||
tcc.AddCategoryMapping("1", TorznabCatType.Movies);
|
||||
tcc.AddCategoryMapping("mov_sd", TorznabCatType.MoviesSD);
|
||||
tcc.AddCategoryMapping("33", TorznabCatType.BooksComics);
|
||||
tcc.AddCategoryMapping("44", TorznabCatType.ConsoleXBox, "Console/Xbox_c");
|
||||
tcc.AddCategoryMapping("con_wii", TorznabCatType.ConsoleWii, "Console/Wii_c");
|
||||
tcc.AddCategoryMapping("45", TorznabCatType.ConsoleXBox, "Console/Xbox_c2");
|
||||
tcc.AddCategoryMapping("40", TorznabCatType.ConsoleXBox, "Console/Xbox_c2");
|
||||
}
|
||||
|
||||
public static void CompareCategoryTrees(List<TorznabCategory> tree1, List<TorznabCategory> tree2)
|
||||
{
|
||||
Assert.AreEqual(tree1.Count, tree2.Count);
|
||||
for (var i = 0; i < tree1.Count; i++)
|
||||
{
|
||||
Assert.AreEqual(tree1[i].ID, tree2[i].ID);
|
||||
Assert.AreEqual(tree1[i].Name, tree2[i].Name);
|
||||
CompareCategoryTrees(tree1[i].SubCategories, tree2[i].SubCategories);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user