114 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
743b7bd163
ttrss: Remove app not available in Trixie
Tests:

- Running 'make build install' remove the module loading include file for ttrss.

- TT-RSS is no longer available in apps page.

- Installing Tor works. Onion header is set correctly. Re-running app setup
works.

- RSS Bridge's description is updated as expected. Links work.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-11-10 19:20:33 -05:00
Sunil Mohan Adapa
a0b2625c6a
tests: functional: Fix incorrect skipping of install tests
Fixes: #2529.

Tests:

- Run functional tests on bepasty. Without the patch, many tests are skipped.
With the patch, all tests are executed. Introducing a sleep delay in
Package.is_available() method also works.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-08-21 10:59:10 +03:00
James Valleroy
c7673e039d
tests: functional: Add enable-all-apps script
[sunil]

- Move the script to plinth/tests/functional directory as it is the right place
for it.

- Add HACKING.md entry to talk about the script.

- Update the pyproject.toml to ensure that functional tests config.ini is
installed along with functional tests python code.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2025-03-24 15:15:01 -07:00
Sunil Mohan Adapa
863d170219
names: Allow adding multiple static domain names
- Change the mechanism for storing domain names in /etc/hosts. Don't write
hostname to /etc/hosts. Don't prepend hostname to domain name. This means that
when hostname changes, set_domain_name need not be called.

- This means that domain names such as example.fbx.one were not resolvable using
/etc/hosts but these will now resolve to 127.0.1.1. This is a minor concern to
becoming a breaking change.

- Don't use socket.getfqdn() for finding the domain name of the machine. Instead
read from /etc/hosts. There does not seem to a glibc/python API for querying
domain names from /etc/hosts with all variations it allows. Forward resolution
properly works no matter the library.

- Drop a pre-Python 3 conversion from unicode to ascii string for hostname. This
is no longer relevant.

- Domain name form is now domain add form. Passing domain name is mandatory.
Domain delete form and view have been introduced.

- Use augeas to edit hosts file. Add privileged methods to add/delete/get
domains. Add method to migration from old format to new. Support reading old
format too in get_domains.

Tests:

- Without hostname written in /etc/hosts, 'resolvectl query <hostname>' and
'ping <hostname>' work.

- With old /etc/hosts format apply patches and restart service. It will be
converted to new format.

- Adding a domain adds a new line to /etc/hosts file. The domain is shown in
domains list in Names app. Applications get reconfigured with the new domain
name.

- Deleting a domain adds a new line to /etc/hosts file. The domain is shown in
domains list in Names app. Applications get reconfigured with the new domain
name.

- Restarting app triggers domain added signal for all domains and all the
domains are shown in the Names app.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-02-16 10:44:50 -05:00
Benedek Nagy
6887c960fe
sogo: Add a new app for SOGo groupware
SOGo is an open source webmail client and groupware available in Debian.
Make a new FreedomBox app for it to be used with the local
Postfix/Dovecot email server.

SOGo requires a database to store events/tasks as well as user settings. Memcached
is also required for caching.

Users log in with their username (as opposed to username + domain on
Roundcube). The host header seen from the first login will be
associated with the user profile. So, if a user logs into SOGo from
freedombox.local and later configures the email server to use
example.com, they will manually have to edit their account(s) to show
the updated domain.

Authentication is done via openldap. It is possible to authenticate with
apache, however it is limited to http basic auth, so mod_auth_tkt cannot
be used. See: b40d777a86/SoObjects/SOGo/SOGoProxyAuthenticator.m (L137)
Configuring http basic auth in my opinion wouldn't add much to
the user experience. It would actually take away the usage of SOGO's built
in TOTP feature.

SOGo only accepts configurations from /etc/sogo/sogo.conf, other configs
from sogo.d don't get recognised.

Use the sogo icon from upstream source. Update sogo.png and sogo.svg to be the
same image (but resized) that is provided in the upstream source. The previous
image was download from Wikimedia Commons.

Update smtp settings so that messages can be sent

Test result for mail deliverability sent with SOGo: https://www.mail-tester.com/test-pdf2yzy6n

The result shows that the message is not DKIM signed. This seems to be
an issue not specific to SOGo. Mails sent from Thunderbird don't get
signed either.

Tests:
- Install app and log in with a FreedomBox user. Create a new event
  titled "Lunch with 🍕 and fries". Confirm the pizza character displays properly.
- Backup the app and uninstall it.
- Restore from the backup, log in and confirm the event gets restored.

To-do:
- test ActiveSync
- create a fail2ban jail
- include the icons in the copyright file
- test sending email in a production setup
- test sieve filters
- write tests

https://salsa.debian.org/freedombox-team/freedombox/-/issues/56

[Sunil]

- App:

  - Update icons to be uniform size as all other apps and copyright information.

  - Since SOGo is not configured to trust the authentication from Apache, it
  does not require FirewallLocalProtection. Remove it.

  - Expand app description. Talk about Email Server app.

  - Update to match recent tags related changes.

  - Make memcached a shared daemon as other processes might use it.

  - Added shared daemon for PostgreSQL.

  - Don't start services when rerunning setup if the app is currently disabled.

  - Don't restart memcached during a restore operation.

- Security:

  - Add system security restrictions to the daemon.

  - Don't use fail2ban jail. SOGo has a mechanism to lock users for a few
  minutes. Use that instead.

- Apache:

  - Make /.well-known URLs work by moving their definitions to global section.

  - Remove old (<2.4) Apache authorization keywords.

  - Simplify, indentation, new line at EOF.

- Manifest:

  - Add more tags.

  - Add SOGo connector, DAVx5, and GNOME Calendar to list of clients.

  - Add 'sogo' to list of service to bring down during backup/restore.

- Privileged:

  - Switch from MySQL to PostgreSQL as it is recommended by SOGo.

  - Use existing utility to generate database password.

  - Use plget and plmerge utilities from gnustep-common package to parse/edit
  the configuration instead of augeas which don't have a dedicated lens.

  - Don't reset the domain when rerunning setup.

  - Ensure that the configuration file has proper ownership and permissions even
  when it did not exist previously.

  - Add typing information for most methods.

  - Remove configuration file after uninstall.

- Configuration:

  - Define database URLs for all seven database tables.

  - Set calendar default roles as suggested in the installation guide.

  - Refresh view automatically every minute to check for new mail.

  - Use the mechanism to lock account after failed login attempts.

  - Add folder name for Junk folder too explicitly.

- Tests: Add basic functional tests.

Tests:

- Functional tests work.

- Rerunning setup does not change the domain back to the primary domain of the
email server.

- Login works. Sending mail and reading mail works. Creating calendar events and
contact works.

- Changing the domain sets the domain value properly in the configuration file.
Configured domain is shown properly on the form.

- Backup and restore work as expected.

- When configuration file is removed and setup is re-run, then the file is
created with proper ownership and permissions.

- 'systemd-analyze security sogo.service' shows a good score.

Signed-off-by: Benedek Nagy <contact@nbenedek.me>
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-01-26 10:50:28 -05:00
Veiko Aasa
fdde1cd40b
tests: functional: Fix typos in diagnostics checks
Signed-off-by: Veiko Aasa <veiko17@disroot.org>
2024-12-29 17:17:14 +02:00
Veiko Aasa
2ae0f19417
tests: functional: Add utility to click element wait for page update
Also, add a click_link_by_href helper function.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
[sunil: Update some more cases to use the utility function]
[sunil: Keep click() and rename new behavior to click_and_wait()]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2024-12-27 16:43:27 -08:00
Sunil Mohan Adapa
0d9bd8d23e
tests: functional: Make first wizard run more robust
- If for some reason, first setup is not completed yet, wait for it to complete.

- Update eventually() method to wait for page load errors to go away.

- If first wizard is already completed, don't try to run it again.

- We can eventually remove waiting for 'setup thread finished' in container
script. But not there yet.

Tests:

- Run transmission tests on a freshly created container.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2024-12-17 22:07:38 +02:00
Sunil Mohan Adapa
765e3176fa
diagnostics: tests: functional: Pick errors more specifically
- When notifications badge is present in navigation bar, that could be confused
for a diagnostics failure. Make the diagnostics failure selector more specific
to avoid this.

- This was caused because of removing .badge-warning/error classes in favor of
.text-bg-warning/danger classes.

Tests:

- Enable ejabberd app and use 'systemctl stop ejabberd.service'. Run system-wide
diagnostics to see a notification with error it and error badge on the
notification icon. Then run functional tests on transmission app which includes
diagnostic tests.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2024-12-12 13:05:12 +02:00
Sunil Mohan Adapa
4d71e80b1e
ui: Drop use of badge-* utility classes for newer replacements
- Keep the badge-{severity} classes as they are meant for convenience of mapping
severity to style.

- Match bootstrap colors to maintain consistency and contrast.

Tests:

- Visually confirm that all the changes effective.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2024-12-12 12:30:28 +02:00
Veiko Aasa
41675eec39
tests: functional: Fix app installation test skipped on slow machines
Fixes an issue where after clicking an app install button (that disables the
button), the app uninstall test is skipped because "App not available in
distribution".

Wait until the app install submit button is not present on the page after
clicking the install button.

Test performed:
 - Increased sleep time to 10s in SetupView. The sharing app uninstall
 functional test pass.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
[sunil: Use wait_for_page_update() instead of eventually]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2024-12-11 12:32:12 -08:00
Veiko Aasa
b3f82974f0
tests: functional: Don't try disable app after tests if app was not installed
Fixes an issue where app tests teardown fails if app installation fails
or app is not available for distribution.

Tests:
 - On Debian Bookworm, all miniflux functional tests are skipped and
   there are no errors.
 - After running gitweb metadata functional test, the app is disabled.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2024-12-05 11:38:38 -08:00
Sunil Mohan Adapa
a32a226492
tests: functional: Fix visit() returning prematurely before page load
- It appears from the functional tests run in Gitlab CI pipelines that visit()
is returning before the page has loaded fully. In the screenshots for help app
test failures, we see gitweb web page.

- To fix this, wait for a proper page load in visit().

- Cleanup syntax, rename the non-existent search class, and mechanism for
matching expected URLs.

- Also refactor waiting for uninstall page in uninstall() method. Using the
wait_for_page_update() method as context processor is more accurate.

Tests:

- Run all functional tests and ensure that there are no errors in visit()
method.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2024-11-09 08:14:51 +02:00
Sunil Mohan Adapa
63ada3ee62
tests: functional: Don't enable/disable app during tests
- Currently, after every test we disable the app and re-enable for the next
test. The original purpose of this disabling is to make sure that an app is
disabled after test on it. So, change the scope of disabling the app to ensure
that it is only disabled once after all the tests on the app. This should
improve the run time of the tests.

Tests:

- Run functional tests on bepasty app.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2024-11-08 10:30:55 +02:00
Sunil Mohan Adapa
3807ee4c54
tests: functional: Wait for uninstall page load before uninstalling
- Many functional test failures in the Gitlab CI pipeline show that uninstall
form was attempted to submitted while still in the app page. After clicking on
the uninstall menu item, we are not waiting for the page to load fully. Fix this
by waiting for page load. This change is expected to fix most of the functional
tests failures in the pipeline.

Tests:

- Ran bepasty functional tests.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2024-11-07 10:07:12 +02:00
Veiko Aasa
b67ce15f89
functional tests: Add pytest testinfra plugin
Adds ability to run local commands with functional tests.

By default, commands are run locally. It is possible to set remote
host connection parameters from pytest command line, for example:
`--hosts 'fbx@IP' --ssh-identity-file '.container/ssh/id_ed25519'`

For more options, see documentation
https://testinfra.readthedocs.io/en/latest/backends.html#ssh.

Includes a fixture `host_sudo` to run commands as sudo.

Relates to
https://salsa.debian.org/freedombox-team/freedombox/-/issues/2451#note_530752.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2024-10-23 21:24:28 -07:00
Veiko Aasa
f12e634bc9
users: Delete or move home folder when user is deleted or renamed
On user deletion, user's home folder is also deleted. Admins have an
option to avoid deleting user's home by inactivating the user instead.

This commit also removes user deletion buttons from the user's list
page and adds this option to the user edit page. The user's edit form
asks for a confirmation if the user deletion is requested. This change
also means that the confirmation password is now required to delete a user.

Also:
  - Add a simple username validation to the privileged actions.
  - Functional tests: Create a fixture to login as an admin before every test.
  - Functional tests: Add a test to check that SSH passwordless login works
    after user is renamed to validate correct SSH related path permissions.
  - Privileged tests: Add `test_` prefix to the generated random string which
    makes easier to check and cleanup created home folders.
  - Minor quote fixes.

Tests performed in stable and testing containers:
  - Run all the users module tests twice, no failures in tests.
  - When user is the last admin, both "Active" and "Delete user"
    checkboxes are disabled.

Closes #2451.

[sunil]

- Refactor the JS code:

  - Ensure that DOM elements are lookup after DOM content is loaded.

  - Styling changes. Reduce the number of globals, name the global names
  somewhat more unique.

  - Click the button instead of submitting the form to disable the button.

- Template changes:

  - Add a body for the confirmation dialog to talk about disabling the user and
  deleting the home directory.

  - Change the label of the confirm button to make it more
  explicit (recommendation from many UX guides).

  - Styling.

- Functional tests:

  - Fix visibility checking of an element to use the correct splinter API.

  - Simplify clicking the edit user link.

- Minor update to form checkbox help text.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2024-10-23 21:13:25 -07:00
Sunil Mohan Adapa
a63c632496
tests: functional: Add package for printing test failures instantly
- Makes it easy to investigate functional test failures as the test are run.

- This will help functional tests that are timing out before failure stack
traces can be shown.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2024-10-17 19:39:53 -07:00
Sunil Mohan Adapa
3f954f9549
tests: functional: Create utility to set user preferred locale
- Move it from the users app functional tests file.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2024-10-16 21:08:25 -07:00
Sunil Mohan Adapa
ed3363105a
networks: Remove first boot steps for connectivity/topology
- We have not yet implemented the main reason they exist. To guide users to
establish reachability with Tor hidden services, Pagekite, Dynamic DNS, etc.

- We now have a 'Next steps' page that talks about configuring network
connections. The networks page linked from here has these steps prominently
listed.

- In the future we will implement a wizard for reachability and these steps will
still be used. However, they don't have to part of first setup. They can add
them as notification and as part of next steps page.

- It is good to have a simplified first setup wizard. It is seldom tested
properly.

Tests:

- Run the first setup wizard by removing /var/lib/plinth/plinth.sqlite3 and
running the service. Notice that the software update step is not shown and
wizard completes successfully.

[vexch: Minor quote fix in functional tests]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2024-10-10 09:19:01 +03:00
Sunil Mohan Adapa
a998995f36
upgrades: Remove step upgrade during first setup
- Remove the first setup wizard step to run security upgrades. At the time of
its introduction, it was felt that this is very important. Some things have
changed since then:

  - We have mechanism for queuing package operations. Users can now trigger
  software updates and start installing apps before that is completed. Or vice
  versa. Earlier if the software updates were running, app install used to fail
  with an error.

  - There were no notifications. Since then we have added 'first setup'
  notification for important topics such as Privacy. This step can be replaced
  with a notification.

  - Automatic diagnostics and a diagnostic to notify of updated packages also
  helps bring attention to software updates if they are missed during first
  setup.

- A proposed change will re-introduce an advice to run updates in the 'Next
steps' wizard step along with a button trigger it right there.

- The new notification for software updates will bring more attention to running
updates as part of first setup.

- It would be nice not be stuck in the first setup wizard for a long period and
make it look simple. It improves the fun factor of setting up FreedomBox.

- It would present an opportunity to utilize the parallel installation of
apps/updates to the full extent. Although this can also be done by skipping the
progress step after updates are run.

- First wizard steps tend to get less testing.

Tests:

- Run the first setup wizard by removing /var/lib/plinth/plinth.sqlite3 and
running the service. Notice that the software update step is not shown and
wizard completes successfully.

- On stable container, backports step is shown as expected (if not already
enabled).

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2024-10-10 09:02:58 +03:00
Veiko Aasa
3dfada85a6
functional tests: Upgrade dependencies selenium and splinter
Fixes an error in testing container where installing dependencies for
functional tests wants to uninstall system installed urllib3.

Also minor quotes fixes.

Note that dependencies are upgraded only in new dev environments where
geckodriver is not yet installed.

Tests performed, in both stable and testing containers:
- Run all tests, no upgrade related failures found. There were some
  seemingly unrelated test failures in apps: calibre, ejabberd, deluged,
  minetest, users, transmission , wordpress, zoph.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2024-09-30 11:47:10 -07:00
Sunil Mohan Adapa
ec25b3a046
tests: functional: Don't timeout when web server restarts
Likely helps: #2271.

When web server restarts we are shown an error page. Trying to lookup and
element in this error page still raises StaleElementReferenceException. However,
if the page was reloaded with driver.visit(), then trying to lookup the old
element does not throw StaleElementReferenceException. Instead the
NoSuchElementException is thrown. For this case, ensure that we stop waiting
appropriately. This is likely to solve the large waits and timeouts when testing
dynamicdns.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2024-09-19 16:17:28 +03:00
Sunil Mohan Adapa
9009cdafd6
config, names: Move domain name configuration to names app
Tests:

- Config app description is as expected.
- Config form does not show domain name field anymore.
  - Submitting the form with changes works.
- Names app has correct link for configuring static domain name. Clicking it
  takes to page for setting domain name.
- On startup, static domian name signal is sent properly if set. Otherwise no
  signal is send.
- Change domain name form shows correct value for current domain name.
- Change domain name form sets the value for domain name properly.
  - Page title is correct.
  - Validations works.
  - Add/remove domain name signals are sent properly.
  - Success message as shown expected
  - /etc/hosts is updated as expected.
- Unit tests work.
- Functional tests on ejabberd, letsencrypt, matrix, email, jsxc, openvpn
- After freshly starting the service. Visiting names app shows correct list of
  domains.
- ejabberd:
  - Installs works as expected. Currently set domain_name is setup properly.
    Copy certificate happens on proper domain.
  - Changing the domain sets the domain properly in ejabberd configuration.
  - Ejabberd app page shows link to name services instead of config app.
    Clicking works as expected.
- letsencrypt:
  - When no domains are configured, the link to 'Configure domains' is to the
    names app.
- matrix-synapse:
  - Domain name is properly shown in the status.
- email:
  - Primary domain name is shows properly in the app page.
  - Setting new primary domain works.
  - When installing, domain set as static domain name is prioritized as primary
    domain.
- jsxc:
  - Show the current static domain name in the domain field. BOSH server is
    available.
- openvpn:
  - Show the current static domain in profile is set otherwise show the current
    hostname.
  - If domain name is not set, downloaded OpenVPN profile shows hostname.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2024-09-19 13:43:32 +03:00
Sunil Mohan Adapa
8c69858d43
config, names: Move setting hostname from config to names
Tests:

- Config app description is as expected.
- Config form does not show hostname anymore.
  - Submitting the form with changes works.
- Names app has correct link for configuring Local Domain Name. Clicking it
  takes to page for setting hostname.
- Avahi shows the current .local domain correctly in Names app.
- Change hostname form shows correct value for current hostname.
- Change hostname form sets the value for hostname properly.
  - Page title is correct.
  - Validations works.
  - Pre/post hostname change signals are sent properly
  - Success message as shown expected
  - hostnamectl shows the set domain
- If domain name is not set, downloaded OpenVPN profile shows hostname.
- Unit tests work.
- Functional tests on names/config/avahi apps work.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2024-09-19 13:42:47 +03:00
Sunil Mohan Adapa
66533a1af5
tests: functional: Name the background fixture
For test cases implemented in derived classes, autouse=True does not seem to
work. These test cases can explicitly request this fixture with the name.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2024-08-03 09:38:18 -04:00
Sunil Mohan Adapa
ef4292d5fc
tests: functional: Allow submitting form buttons along with inputs
- Sometimes <input type='submit'> are used as submit buttons and at other times
<button type='submit'> is used.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2024-08-03 09:38:09 -04:00
Sunil Mohan Adapa
dd6b865de6
tests: functional: Handle obscured elements when submitting forms
In some cases in the backup page, when trying to restore a backup, the button is
obscured and trying to click it fails. Handle such situations by scrolling the
element into view first and try to click on the element again. Ensure that our
navigation header does not obscure the element when scrolling it into view.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2024-07-29 15:54:38 -04:00
Sunil Mohan Adapa
170685c806
tests: functional: Handle click failure when waiting for page update
When a click fails because the element is obscured or out of scroll port, the
fails with ElementClickInterceptedException. This normally fails the test
properly. However, when waiting for a page update, the wait loop silently
swallows the error causing the click failure to be ignored. This later leads to
a timeout waiting for page to be updated.

Handling this error separately and re-raising it ensures that the test fails
with the correct error allowing us to fix the problem.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2024-07-29 15:54:35 -04:00
Sunil Mohan Adapa
9d2a11b874
users: Add email address field when creating/updating user accounts
Closes: #1826.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2024-03-14 18:07:16 +02:00
Sunil Mohan Adapa
5dbf890881
tests: functional: Refactor install/setup fixture for apps
- Fixes an issue with zoph not being setup after uninstall+install setup and
makes a test pass.

- Some failures exist but don't seem related to this change.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2024-03-11 16:50:56 -04:00
Sunil Mohan Adapa
d23ceb7050
tests: functional: Uninstall app after backup and before restore
Closes: #2353.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2024-03-11 16:50:47 -04:00
Sunil Mohan Adapa
526a3018e4
users: Fix creating users with initial set of groups
Fixes: #2409.

When creating a user if one or more groups is selected, creation fails. This
is because the fields contains group choices as (name, label) tuples instead
of (group_id, label) tuples as expected by the many-to-many field mapping
mechanism in ModelField class. Fix this by using the same mechanism used in
UserUpdateForm, which is to reuse the base class form field (but adjust some
properties).

Tests:

- During first boot
  - Django groups are fully created when form is accessed with blank database
- In user creation/modify form:
  - Label appears are 'Permissions'
  - Choices appear fully and as 'Description (Group name)'
  - Help text is correct.
  - Choices are sorted on group name.
  - Django groups are fully created when form is accessed when a new group is
    added to code.
  - User can have no groups
  - Widget is multiple checkbox widget. Multiple groups can be selected.
  - User is added to proper ldap groups after submission
- In user modify form:
  - If the user is last admin user, admin checkbox is checked and disabled.
  - Current list of groups is accurate shown when form is displayed.
  - Add remove of groups works as expected
- Functional tests for gitweb and users apps pass

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2024-03-08 11:28:54 +02:00
Joseph Nuthalapati
fd1955a084
tests: functional: Run tests on two app servers
- Using `--dist=loadscope` splits the tests based on module, thus
  ensuring each app's tests get assigned to one worker only.
- Though app servers run in 2 separate VMs, the pytest-xdist workers
  simply run in two Python subprocesses (`-n 2`). This allows us to
  generate a unified test report.

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2023-11-05 09:21:47 -08:00
Sunil Mohan Adapa
c4f087ea4a
networks, samba: tests: functional: Fix setting firewall zone
Without the changes, the form submission for setting firewall zone fails with
error similar to "element can't be scrolled to view".

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2023-08-23 21:47:51 -04:00
Sunil Mohan Adapa
cf6c604cec
sso: Use POST method for logout
- This prevents CSRF attacks that allow adversarial websites from logging out
users from FreedomBox. Django itself has made this change in 4.x releases.

Tests:

- Logout works with the menu item in drop-down when Javascript is enabled. The
menu item appears similar to other drop-down menu items.

- Logout works with the menu item when JavaScript is disabled on the page. The
menu item appears similar to other menu items.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2023-08-23 21:47:36 -04:00
Sunil Mohan Adapa
4be7ce0f5d
tests: functional: Update detecting page changes
Several tests failed randomly (on a slightly slow machine) while trying to
detect that a page change has occurred. Workaround this by handling the
exception thrown.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2023-04-24 20:54:58 -04:00
Sunil Mohan Adapa
fcbcf1775c
tests: functional: Remove handling for custom enable/disable buttons
All the apps including OpenVPN now use AppView and therefore using the standard
enable/disable button.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2023-04-24 20:54:55 -04:00
Sunil Mohan Adapa
4cfc2fb4f2
tests: functional: Make install script work for Bullseye
- Pip option --break-system-packages is available only from Bookworm.

- Remove --user to that the script works can be used broadly.

Tests:

- On a fresh stable container, running functional tests works. Without the
patch, it fails.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2023-04-05 08:50:08 -04:00
Veiko Aasa
485107604f
tests: functional: Fix setting first ethernet connection as internal
Tested that all samba tests pass in testing container. Also checked that
connection type texts are not translated, thus safe to use in xpath search.

Fixes #2333.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2023-03-26 11:26:28 -04:00
Veiko Aasa
9c0e339daf
container: Force pip to install packages to system environment
Without the change, pip refuses to install into system environment due to
changes outlined in PEP 668. The following error is thrown: 'error:
externally-managed-environment'.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2023-03-26 08:49:39 -04:00
James Valleroy
bb544b0a6d
dynamicdns: Skip uninstall test
Tests:

- test_uninstall is skipped for dynamicdns.

- test_uninstall is passed for bepasty.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2023-02-13 16:11:00 -08:00
Sunil Mohan Adapa
a94ebc567d
tests: functional: Fix submitting forms with notifications present
Closes: #2194.

In the four cases fixed, if a notification is present with a 'btn-primary' in
it, then instead of submitting the intended form, the button on the notification
is clicked. This will result in an indefinite wait for the form to perform an
action. Fix this by specifying which form exactly we want to submit.

Tests:

- Run functional tests for config app and updates app.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2023-01-30 18:20:53 -05:00
nbenedek
7e2ebcb743
privacy: Add new system app for popularity-contest
- Keep the description about app generic

- Remove enable/disable option

- Create a booleanfield to turn on/off popcon

- Don't re-enable popcon during an update

Tests:

- When enabling/disabling the option, the `"PARTICIPATE"` value in
`/etc/popularity-contest.conf` is changed to yes/no as expected. For reference
see `/var/lib/dpkg/info/popularity-contest.templates`

- When popcon option is enabled, running sudo sh -x
/etc/cron.daily/popularity-context shows that execution was successful and data
was submitted. Remove files /var/log/popularity-contest* and
/var/lib/popularity-contest/lastsub if necessary. Gpg is used and encrypted data
is what was submitted.

- When popcon option is disabled, running sudo sh -x
/etc/cron.daily/popularity-context shows that execution stopped because the
option is disabled.

Signed-off-by: nbenedek <contact@nbenedek.me>
[sunil: Add a notification to tell users about privacy app]
[sunil: Correct the URL to /sys]
[sunil: Minor code styling changes and updates to description, icon]
[sunil: Ensure that popcon works with encryption]
[sunil: Write configuration to a separate file]
[sunil: Use Shellvars lens instead of Php lns]
[sunil: Add functional tests]
[sunil: Backup/restore the configuration file]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-10-10 17:35:26 -07:00
Sunil Mohan Adapa
11a27d8efc
ttrss: Use privileged decorator for actions
Tests:

- Ignore setting a None domain
- Updated tests to use base class

- Functional tests work
  - Backup/restore works. Database is dumped and restored.
- Initial setup works
- Enabling/disabling works
  - API access is enabled and a valid domain is set when available
- Setting the domain works
  - Configuration is updated in update.php
  - App page show newly set domain
- Not tested: force upgrade of package

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-10-08 18:53:30 -04:00
Sunil Mohan Adapa
a16af8c37a
tests: functional: Wait for installation to complete fully
- There is a special page which is served when race condition occurs between the
setup middleware and setup view soon after an installation. In this case, a
special page is shown with 'App installed' as message but this is still the
setup view. Detect this case and wait for page to refresh.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-09-03 17:29:13 -04:00
Sunil Mohan Adapa
38610d8eb8
tests: functional: Force specifying form to submit more accurately
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-09-03 17:29:11 -04:00
Sunil Mohan Adapa
e87752e065
users: tests: functional: Find forms more accurately
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-09-03 17:29:09 -04:00
Sunil Mohan Adapa
625146329d
backups: tests: functional: Find forms more accurately
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-09-03 17:29:01 -04:00
Sunil Mohan Adapa
5935ce89a6
sso: tests: functional: Find forms more accruately
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-09-03 17:28:56 -04:00