tt-rss: More comprehensive test

gileri e09c54ce 2cc6ef5b

Changed files
+30 -1
nixos
tests
web-apps
pkgs
by-name
tt
tt-rss-plugin-auth-ldap
tt-rss-theme-feedly
+20 -1
nixos/tests/web-apps/tt-rss.nix
···
enable = true;
virtualHost = "localhost";
selfUrlPath = "http://localhost/";
singleUserMode = true;
};
};
testScript = ''
machine.wait_for_unit("tt-rss.service")
-
machine.succeed("curl -sSfL http://localhost/ | grep 'Tiny Tiny RSS'")
'';
}
)
···
enable = true;
virtualHost = "localhost";
selfUrlPath = "http://localhost/";
+
pluginPackages = with pkgs; [
+
tt-rss-plugin-auth-ldap
+
];
singleUserMode = true;
+
themePackages = with pkgs; [ tt-rss-theme-feedly ];
};
};
testScript = ''
+
import json
+
import re
machine.wait_for_unit("tt-rss.service")
+
+
matches = re.search('__csrf_token = "([^"]*)"', machine.succeed("curl -sSfL --cookie cjar --cookie-jar cjar -sSfL http://localhost/"))
+
if matches is None:
+
assert False, "CSRF token not found"
+
csrf_token = matches.group(1)
+
+
# Ensure themes are loaded. No API found for these, so it's a crude check.
+
preference_page = machine.succeed("curl -sSfL --cookie cjar --cookie-jar cjar http://localhost/backend.php?op=Pref_Prefs")
+
assert "feedly" in preference_page
+
+
plugins = json.loads(machine.succeed(f"curl -sSfL --cookie cjar --cookie-jar cjar 'http://localhost/backend.php' -X POST --data-raw 'op=Pref_Prefs&method=getPluginsList&csrf_token={csrf_token}'"))["plugins"]
+
expected_plugins = ["auth_ldap"];
+
found_plugins = [p["name"] for p in plugins if p["name"] in expected_plugins]
+
assert len(found_plugins) == len(expected_plugins), f"Expected plugins {expected_plugins}, found {found_plugins}"
'';
}
)
+5
pkgs/by-name/tt/tt-rss-plugin-auth-ldap/package.nix
···
{
lib,
stdenv,
fetchFromGitHub,
}:
···
installPhase = ''
install -D plugins/auth_ldap/init.php $out/auth_ldap/init.php
'';
meta = with lib; {
description = "Plugin for TT-RSS to authenticate users via ldap";
···
{
lib,
+
nixosTests,
stdenv,
fetchFromGitHub,
}:
···
installPhase = ''
install -D plugins/auth_ldap/init.php $out/auth_ldap/init.php
'';
+
+
passthru = {
+
tests = { inherit (nixosTests) tt-rss; };
+
};
meta = with lib; {
description = "Plugin for TT-RSS to authenticate users via ldap";
+5
pkgs/by-name/tt/tt-rss-theme-feedly/package.nix
···
{
lib,
stdenv,
fetchFromGitHub,
}:
···
cp -ra feedly *.css $out
'';
meta = with lib; {
description = "Feedly theme for Tiny Tiny RSS";
···
{
lib,
+
nixosTests,
stdenv,
fetchFromGitHub,
}:
···
cp -ra feedly *.css $out
'';
+
+
passthru = {
+
tests = { inherit (nixosTests) tt-rss; };
+
};
meta = with lib; {
description = "Feedly theme for Tiny Tiny RSS";