Files
nixpkgs/nixos/tests/freshrss/extensions.nix
2026-09-16 22:44:16 +02:00

39 lines
1.2 KiB
Nix

{
name = "freshrss-extensions";
nodes.machine =
{ pkgs, ... }:
{
services.freshrss = {
enable = true;
baseUrl = "http://localhost";
authType = "none";
extensions = [
pkgs.freshrss-extensions.youtube
pkgs.freshrss-extensions.title-wrap
];
};
};
extraPythonPackages = p: [
p.lxml
p.types-lxml
];
testScript = ''
import json
from lxml import etree
machine.wait_for_unit("multi-user.target")
machine.wait_for_open_port(80)
response = machine.succeed("curl --fail-with-body --silent http://localhost:80/i/?c=extension")
assert '<span class="ext_name disabled">YouTube Video Feed</span>' in response, "Extension not present in extensions page."
# enable Title-Wrap extension
tree = etree.HTML(response)
csrf = json.loads(tree.xpath('//script[@id="jsonVars"]/text()')[0])["context"]["csrf"]
machine.succeed(f"curl --fail-with-body --silent 'http://localhost:80/i/?c=extension&a=enable&e=Title-Wrap' -d '_csrf={csrf}'")
# verify that the Title-Wrap css is accessible.
machine.succeed("curl --fail-with-body --silent 'http://localhost:80/ext.php?1=&f=xExtension-TitleWrap/static/title_wrap.css'")
'';
}