6744 Commits

Author SHA1 Message Date
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
James Valleroy
95a3784f02
ttrss: 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:04 -07:00
James Valleroy
79f09e3d88
transmission: 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:28:55 -07:00
James Valleroy
1bc42a7647
tor: Convert functional tests to non-BDD python format
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Remove use of text constants for bool values (artifact of bdd)]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-05 15:28:47 -07:00
James Valleroy
e500f191b3
tahoe: 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:28:39 -07:00
James Valleroy
7ea6eeeac8
syncthing: 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:23:23 -07:00
James Valleroy
3bbbd0c812
storage: 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:23:14 -07:00
James Valleroy
667f2575b6
sso: 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:23:06 -07:00
James Valleroy
f8258fcef4
ssh: Convert functional tests to non-BDD python format
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Ensure app is enabled after tests]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-05 15:22:58 -07:00
James Valleroy
b9f561a43f
snapshot: 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:22:50 -07:00
James Valleroy
a51e4aaa1c
sharing: 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:22:42 -07:00
James Valleroy
d3c7383cb6
shadowsocks: Convert functional tests to non-BDD python format
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Properly changes the values before restoring from backup]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-05 15:22:33 -07:00
James Valleroy
9ec995a741
security: 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:22:24 -07:00
James Valleroy
6aecad7259
searx: 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:22:16 -07:00
James Valleroy
60236376c2
roundcube: 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:22:08 -07:00
James Valleroy
c120411846
radicale: Convert functional tests to non-BDD python format
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Set an initial value before testing for access rights]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-05 15:22:00 -07:00
James Valleroy
8daa9aa49d
quassel: 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:21:52 -07:00
James Valleroy
650c16f914
tests: Add backups mark for openvpn, pagekite, privoxy
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-05 15:21:44 -07:00
James Valleroy
93e9f95d18
privoxy: 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:21:35 -07:00
James Valleroy
98cc6c4753
pagekite: 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:21:27 -07:00
James Valleroy
8dea7d3c79
openvpn: 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:21:19 -07:00
Andrij Mizyk
f801e768f3
Translated using Weblate (Ukrainian)
Currently translated at 78.7% (1192 of 1514 strings)
2021-10-02 23:38:06 +02:00
109247019824
b6aa6bab09
Translated using Weblate (Bulgarian)
Currently translated at 7.1% (109 of 1514 strings)
2021-09-29 16:38:10 +02:00