6766 Commits

Author SHA1 Message Date
James Valleroy
6358d4fcd3
roundcube: Use BaseAppTests for functional tests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-18 10:28:03 -07:00
James Valleroy
ed46278550
mumble: Use BaseAppTests for functional tests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-18 10:27:59 -07:00
James Valleroy
fae88d9fff
infinoted: Use BaseAppTests for functional tests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-18 10:27:56 -07:00
James Valleroy
bed579c377
tests: Add run diagnostics test to BaseAppTests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Use more forgiving selectors]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-18 10:27:53 -07:00
James Valleroy
74e3cb9946
tests: Add BaseAppTests class for common functional tests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Use the verb 'assert' instead of 'confirm']
[sunil: More documentation for base app tests class]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-18 10:27:50 -07:00
Sunil Mohan Adapa
8899bdef7b
email_server: Move roundcube link from My Mail to description
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
[fioddor: squash create and remove commits as parts of the same move]
Reviewed-by: Fioddor Superconcentrado <fioddor@gmail.com>
2021-10-18 12:49:57 +02:00
Sunil Mohan Adapa
f3d9a499eb
email_server: clients: Launch roundcube directly instead of app page
- Maintain consistency with rest of the apps and do what the user will mostly
expect.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Fioddor Superconcentrado <fioddor@gmail.com>
2021-10-18 12:49:57 +02:00
Sunil Mohan Adapa
ba4daeb9bb
email_server: Don't let the My Mail page to blank page
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Fioddor Superconcentrado <fioddor@gmail.com>
2021-10-18 12:49:56 +02:00
Sunil Mohan Adapa
3ee76e38a5
email_server: Add heading for manage aliases page
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
[fioddor: Keep email_alias.html based on email_form_base.html to avoid
inconsistent UI]
Reviewed-by: Fioddor Superconcentrado <fioddor@gmail.com>
2021-10-18 12:44:19 +02:00
Sunil Mohan Adapa
0e207621de
email_server: Add a name for aliases view
So that it can be easily URL reversed.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Fioddor Superconcentrado <fioddor@gmail.com>
2021-10-17 14:24:33 +02:00
Sunil Mohan Adapa
9c578a36fd
email_server: yapf formatting
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Fioddor Superconcentrado <fioddor@gmail.com>
2021-10-17 14:24:17 +02:00
nautilusx
2bc07485ab
Translated using Weblate (German)
Currently translated at 100.0% (1515 of 1515 strings)
2021-10-17 11:37:24 +02:00
Sunil Mohan Adapa
b0e3aaa356
middleware: Don't show setup view to non-admin users
This is an improvement over !2069, which solved #2094.

Tests:

- Install an app. Success result is shown.

- Install an app and kill the apt-get process in the middle. Error result is
shown.

- Click install on an app (email_server). Close the window without seeing the
result. Access the app page (like email_server/my_aliases) as a non-admin user.
No success/file message is shown. The page is shown properly. Access the page as
admin, success message is shown.

- Access an uninstalled/installed app page as anonymous user. User is redirected
to login page.

- Access an uninstalled/installed app page as non-admin user. Forbidden page is
shown.

- Access an uninstalled app page meant for non-admin users (such as
email_server/my_aliases) as non-admin user. Forbidden page is shown.

- Access an installed app page as admin. Success.

- Access an installed app page meant for non-admin users (such as
email_server/my_aliases) as admin. Success.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>

Reviewed-by: Fioddor Superconcentrado <fioddor@gmail.com>
2021-10-16 20:56:23 +02:00
nautilusx
df2c1ab252
Translated using Weblate (German)
Currently translated at 99.9% (1514 of 1515 strings)
2021-10-14 21:48:45 +02:00
Andrij Mizyk
f7e14c611c
Translated using Weblate (Ukrainian)
Currently translated at 79.4% (1203 of 1515 strings)
2021-10-13 10:35:29 +02:00
Burak Yavuz
a8dbecb529
Translated using Weblate (Turkish)
Currently translated at 100.0% (1515 of 1515 strings)
2021-10-13 10:35:29 +02:00
James Valleroy
dc6282676d
Release v21.11 to unstable
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
v21.11
2021-10-11 18:55:46 -04:00
James Valleroy
35a368929c
doc: Fetch latest manual
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-11 18:54:28 -04:00
James Valleroy
a9fd85ddf7
locale: Update translation strings
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-11 18:26:24 -04:00
Sunil Mohan Adapa
c7c9d49939
ttrss: Add systemd security hardening to daemon
→ Overall exposure level for tt-rss.service: 1.1 OK 🙂

Tests:

- Run ./setup.py install. systemctl daemon-reload. Subscribe to a new feed and
don't wait for it load the feed. Then start/restart the daemon. The daemon
successfully fetches the feed. When tt-rss interface is loaded again the feed
items are available.

- For getting output of the daemon add StandardOutput=journal option to the
service file.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-11 15:47:05 -04:00
Sunil Mohan Adapa
2c4423baaf
ttrss: Fix daemon not running sometimes on startup
- Sometimes when postgres is not available, the daemon fails to create a
database connection. In this case the daemon permanently exits with code 101
instead of trying again.

- This happens more prominently when booting the system and postgres may not be
available. Although tt-rss.service has Wants= and After= on postgres.service, it
appears that postgres does not have proper startup notification with systemd.

- This may also happen in other situations such as when temporarily restarting
postgres during upgrades or backup/restore operations.

- Fix the issue by make the daemon restart after a failure. This seems
appropriate because the daemon is coded like a web page to fail and exit on
all, even temporary, errors.

Tests:

- Without the patch, stop postgres@13-main.service. Start tt-rss.service. It
will fail permanently and not try to restart.

- With the patch, daemon-reload systemd. Notice that the intended changes
reflect with systemd status. Start the service. It fails. But retries 2 minutes
later with failure again. When postgres is started again, the next attempt
succeeds.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-11 15:46:59 -04:00
Sunil Mohan Adapa
9bd1f80d5c
*: Always pass check= argument to subprocess.run()
- Avoid flake8 warnings.

- Makes the call more explicitly readable in case an exception is expected but
check=True is not passed by mistake.

Tests:

- Many tests are skipped since the changes are considered trivial.
check=False is already the default for subprocess.run() method.

- actions/package: Install an app when it is not installed.

- actions/upgrade: Run manual upgrades.

- actions/users: Change a user password. Login. Create/remove a user.

- actions/zoph: Restore a database.

- container: On a fresh repository, run ./container up,ssh,stop,destroy for a
testing container.

- plinth/action_utils.py: Enable/disable an app that has a running service.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-11 14:34:40 -04:00
Sunil Mohan Adapa
ebd357476d
performance: Cleanup code meant for cockpit version < 235
Bullseye and higher has version 239 or higher.

Tests:

- From performance app, launch the web interface in a testing container. Web
interface shows up properly.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-11 06:36:25 -04:00
Sunil Mohan Adapa
9faeedbf8f
tests: Drop installation of pytest-bdd
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-11 06:29:01 -04:00
Sunil Mohan Adapa
148d1ea311
package: Remove unused import to fix pipeline
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-10 19:43:13 -07:00
Fioddor Superconcentrado
376fe5a85b
email: Manage known installation conflicts
Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Don't show warning on conflict]
[sunil: Add statement to description about conflicts]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-10 19:22:22 -07:00
Fioddor Superconcentrado
4b2162f3fd
setup: Show and remove conflicts before installation
Warn of installed conflicting packages before installing apps.

[sunil: Rename 'advice' to 'action']
[sunil: Action will be string constant, for better API and i18n]
[sunil: Don't show conflict warning if action is 'ignore']
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-10 19:22:19 -07:00
Fioddor Superconcentrado
24f7ffe3cf
package: Add functions for removing packages
Functions needed to spot and remove installed conflicting packages
before installation of apps.

- Remove all packages in a single operation as this way apt can search for
solutions to conflicts more easily.

- Use type hints rather than a lot of type checking. Type hints shall later be
enforced using offline checking (with mypy) or at runtime (with enforce, etc.).

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Run single remove operation on all packages]
[sunil: Use type hints instead of extensive type checking]
[sunil: Trim down the test case as it would only succeed after install]
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>

package
2021-10-10 19:22:16 -07:00
Fioddor Superconcentrado
cb539cf1e8
tests: Improve handling of tests skipped by default
- Create the 'heavy' mark for tests that take long to run.
- Skip the tests marked as 'heavy' by default.
- Enable functional and heavy tests by setting the environment variable
  EXTENDED_TESTING=1.
- Update HACKING.md accordingly.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Minor indentation]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-10 19:22:13 -07:00
Sunil Mohan Adapa
4b708214e4 storage: tests: functional: Fix tests always getting skipped
- The method to check if we are running inside a container is not being called.
Call it.

- Also fix the assumption that tests and freedombox service run on the same
machine. Be conservative and assume running in container if we can't determine
the accurate state.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>

Reviewed-by: Fioddor Superconcentrado <fioddor@gmail.com>
2021-10-10 18:22:11 +02:00
Sunil Mohan Adapa
2b525a1930
d/rules: Don't install and enable other systemd service files
Close: #1982.

This eliminates the issue with calibre and wordpress services getting run even
before the app is installed. These services are enabled when the app is
installed. On disadvantage is that services are no longer restarted when a newer
service file is installed.

Users for whom caibre and wordpress have already been enabled. Nothing changes
on upgrade and service will still be enabled. However, the services won't be
attempted to be started without the app's being installed. This is good enough
without having to write custom logic to disable these services.

Tests:

- Install freedombox package on a fresh setup. wordpress and calibre service
files are not enabled.

- When wordpress and calibre apps are installed, these services are enabled and
run as expected.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-09 22:09:03 -04:00
Sunil Mohan Adapa
1c47877f6b
calibre: Run service only if when installed
- This avoids attempting to run the service soon after FreedomBox is installed.

Tests:

- When old freedombox.deb is installed, the service is enabled. When upgraded to
newer .deb with the changes, the service is still enabled but no start attempt
is made by systemd.

- After installation of calibre, the service is running as expected.

- On a fresh installation, calibre service is working as expected.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-09 22:09:00 -04:00
Sunil Mohan Adapa
cf054b0888
wordpress: Run service only if when installed and configured
- This avoids attempting to run the service soon after FreedomBox is installed.

Tests:

- When old freedombox.deb is installed, the service is enabled. When upgraded to
newer .deb with the changes, the service is still enabled but no start attempt
is made by systemd.

- After installation of WordPress, the service is running as expected.

- On a fresh installation, WordPress service is working as expected.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-09 22:08:56 -04:00
Sunil Mohan Adapa
071d61bcc8
*: Move all systemd service files from /lib to /usr
This is now the preferred location in Debian. See:

https://lintian.debian.org/tags/systemd-service-in-odd-location
https://bugs.debian.org/992465
https://bugs.debian.org/987989
d70caa69c6
https://lists.debian.org/debian-devel/2021/08/msg00275.html

Tests:

- Lintian no longer shows errors:
  E: freedombox: systemd-service-in-odd-location lib/.../calibre-server-freedombox.service

- Comparing the old .deb and newly generated .deb with these changes. All the
systemd files show that they are moved from /lib to /usr/lib/systemd.

- After upgrading the deb from older version to a version these changes,
services installed by the package are available (tested after restart with
wordpress and claibre). Services tweaked by the package have the changed
configuration reflected as shown by systemctl show
{service-name}.service (tested after restart with quassel).

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-09 22:08:50 -04:00
Sunil Mohan Adapa
379e0af9c9
translation: Always set language cookie when switching language
Django 3.0 will now always set the language cookie. It will stop setting the
session language in Django 4.0. To avoid breaking current behavior, always set
the language cookie when switching language.

"To limit creation of sessions and hence favor some caching strategies,
django.views.i18n.set_language() will stop setting the user’s language in the
session in Django 4.0. Since Django 2.1, the language is always stored in the
LANGUAGE_COOKIE_NAME cookie."

Tests:

- All relevant functional tests run.

- Repeat login and user page editing tests.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-09 21:03:29 -04:00
Sunil Mohan Adapa
57931353d3
sso, translation: Help set language cookie when user logins in
This patch only ensures that response object is send along with set_language()
call. In later changes, response object can be used by set_language() to set the
language cookie.

Tests:

- Relevant functional tests pass.

- Login, user's language is set when the language is set to non-browser sent
language.

- Logout, user's language is retained when set to non-browser sent language.

- Login, user's language is set when the language is set to browser sent
language.

- Logout, user's language is retained when set to browser sent language.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-09 21:03:26 -04:00
Sunil Mohan Adapa
45b5769ce6
users: Help set language cookie when user profile is edited
This patch only ensures that response object is send along with set_language()
call. In later changes, response object can be used by set_language() to set the
language cookie.

Tests:

- Relevant functional tests pass.

- Edit current user's language. The language is immediately set.

- Edit another user's language. The language of the current session is not changed.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-09 21:03:23 -04:00
Joseph Nuthalapati
79e5edb097
ttrss: tests: functional: Make subscription faster
- Remove an unnecessary eventually block that's always reaching timeout (30 sec).

- Simplify selection of hamburger menu. The CSS classname used for selection is
the same in buster and bullseye.

- Create a constant for String 'ttrss'

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-08 19:02:32 -07:00
Sunil Mohan Adapa
f2bcecdf74
d/rules: Don't use setup.py to invoke tests, invoke directly instead
Invoking pytest from setup.py seems to be deprecated. It offers no real
advantages other than being predictable way of invoking tests for someone who
don't know that we use pytest for testing. Let's rely on our documentation
instead. Further this clears up the need to have setup.cfg.

Tests:

- Build debian package in using pbuilder. Tests are run and succeed during the
build.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-07 15:14:09 -04:00
Sunil Mohan Adapa
3c370d02ab
pyproject.toml: Merge contents of .converagerc
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-07 15:13:59 -04:00
Sunil Mohan Adapa
04af3473b7
pyproject.toml: Merge contents of pytest.ini
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-07 15:13:46 -04:00
Sunil Mohan Adapa
17a83dee60
settings: Choose password hashing complexity suitable for SBCs
- Django 3.2 has a argon2 password hashing complexity unsuitable for single
board computers. Choose parameters suitable for Olimex Lime2 boards.

Tests:

- In a browser, login to a user without these changes. Notice the hash
parameters in sqlite3 auth_user table. Login with the changes. Notice that the
hash has been updated with latest has parameters.

- Login in Django 2.2 and Django 3.2. Login succeeds and hash parameters are
updated.

- As measured by the browser. Notice that change in login request time with and
without these changes

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-07 10:48:11 -04:00
Sunil Mohan Adapa
99c2325206
user: Accommodate Django 3.1 change for model choice iteration
- Before Django 3.1, iterating the .choices for a field would yield (id, label)
tuples directly suitable for use with ChoiceFields. From Django 3.1, id is an
instance of ModelChoiceIteratorValue which helps to easily find the model
instance. In most cases, using the proxy works, but in our case, the value is
being hashed. Access the actual value of the field from the object to avoid this
issue.

- Cleanup widget for disabling individual checkboxes in a group

- When a form is submitted, 'disabled' input field is omitted by the browser
irrespective of its value. So, the last admin user, automatically add the
'admin' group to form values.

Tests:

- On Django 2.2 and Django 3.2 access the user edit page. The form should render
as before the change without errors.

- Test with the current user as the last admin user. The 'admin' checkbox should
be read-only.

- Test with the current user not as the last admin user. The 'admin' checkbox
should not be read-only.

- Add/remove non-admin groups and save the current/different user.

- Access the user edit page as non-admin user, the groups should be disabled.

- Give/take admin permission to/from a user other than current user.

- Take admin permission from current user.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-07 10:36:14 -04:00
James Valleroy
4f79096d07
conftest: Skip functional tests if splinter not importable
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-06 14:22:38 -07:00
Sunil Mohan Adapa
b4e3824a4a
d/control: Allow building with python interpreter of any arch
python3-all:any means that python3 interpreter of any architecture could be used
to build the package. python3-all means that same architecture as the build
process would be needed. This is a stricter restriction and is unnecessary for
the case of freedombox package.

See discussion in: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=995498

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-06 09:48:25 -04:00
James Valleroy
38bbca76c6
tests: Drop step definitions
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-05 15:30:13 -07:00
James Valleroy
9bad96c863
tests: Add some missed marks for functional tests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-05 15:30:04 -07:00
James Valleroy
0aaf9ad6df
users: Convert functional tests to non-BDD python format
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Delete user before running create test]
[sunil: Minor refactor for simplicity]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-05 15:29:29 -07:00
James Valleroy
a89b4de8b7
zoph: Convert functional tests to non-BDD python format
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-05 15:29:21 -07:00
James Valleroy
c92c95e39d
upgrades: Convert functional tests to non-BDD python format
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-05 15:29:13 -07:00