Package CI problems

I updated by project here: master <- testing by jedie · Pull Request #40 · YunoHost-Apps/django-fmd_ynh · GitHub

In the new v0.9.1 version it works like this:

Requesting the root page “/” as anonymous will redirect to login /yunohost/sso/?next=/
So the user is authenticated via SSO and can access the root page.

Before this Pull request it was a intermediate page rendered by django.

I tested the new changes manually on my YunoHost installation and it works fine.

But in CI it totally fails:

I still have the old check_process file, but looking at GitHub - YunoHost/package_check: Shell script which check package actions: install, remove, upgrade, backup, restore… offers that’s not supported anymore? Was replaced by tests.toml
Is the the problem?!?

Maybe Remove "check_process" and update tests.toml by jedie · Pull Request #41 · YunoHost-Apps/django-fmd_ynh · GitHub fill fix it :wink:

Think i found a limitation in tests.toml

I would like to test that anonymous users will be redirect to SSO portal for login. But this can’t be tested, because this doesn’t work:

    # Access the root page not logged in results in redirect to portal to login
    home.path = "/"
    home.logged_on_sso = false
    home.expect_effective_url = "https://__DOMAIN__/yunohost/sso/?next=/"

    # Access the Django Admin not logged in results in redirect to portal to login
    admin.path = "/admin/"
    admin.logged_on_sso = false
    admin.expect_effective_url = "https://__DOMAIN__/yunohost/sso/?next=/admin/"

expect_effective_url can’t have placeholders, isn’t it?

It’s also not possible to just test the expect_return_code, because empty expect_effective_url will also not work.

    if expect_effective_url is None and "/yunohost/sso" in effective_url:
        errors.append(
            f"The request was redirected to yunohost's portal ({effective_url})"
        )
    if expect_effective_url and expect_effective_url != effective_url:
        errors.append(
            f"Ended up on URL '{effective_url}', but was expecting '{expect_effective_url}'"
        )

see: package_check/lib/curl_tests.py at 744f0baa48eb8535fb7022033231266884d0f8d1 · YunoHost/package_check · GitHub

Untested PR to Allow “DOMAIN” placeholder in expect_effective_url :

Sadly it’s more complicated.

Replacement of __DOMAIN__ is helpfull but it’s sadly not possible to test the “need login” redirections via tests.toml if the App can be installed at root domain and in a directory.

But the “return to app” values like /yunohost/sso/?r=aHR0cHM6Ly90ZXN0c2VydmVyL2FwcF9wYXRoL2xvZ2luLXJlcXVpcmVkLw%3D%3D depends on install location. So they can’t hardcoded into tests.toml

What about a complete different solution for these kind of tests?

In tests.toml it’s only needed to define the URL of the App, that will redirect to SSO login.
The “package_check / curl_tests” will do the complete login flow with correct redirects and it only pass the test if we are redirected back to the app. In this case tests like “expect_title” and “expect_content” are then also possible.