mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +00:00
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>
44 lines
1.4 KiB
Python
44 lines
1.4 KiB
Python
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
"""
|
|
Tests for names module.
|
|
"""
|
|
|
|
import pytest
|
|
|
|
from .. import on_domain_added, on_domain_removed
|
|
from ..components import DomainName, DomainType
|
|
|
|
|
|
@pytest.fixture(name='clean_domains')
|
|
def fixture_clean_domains():
|
|
"""Test fixture to start a test with clean domains list."""
|
|
DomainName._all = {} # pylint: disable=protected-access
|
|
|
|
|
|
@pytest.mark.usefixtures('clean_domains')
|
|
def test_on_domain_added():
|
|
"""Test adding a domain to the global list."""
|
|
on_domain_added('', '')
|
|
assert not DomainName.list()
|
|
|
|
DomainType('domain-type-tor', 'Tor Domain', 'torurl')
|
|
on_domain_added('tor', 'domain-type-tor', 'ddddd.onion')
|
|
on_domain_added('tor', 'domain-type-tor', 'eeeee.onion')
|
|
DomainName.get('domain-tor-ddddd.onion')
|
|
DomainName.get('domain-tor-eeeee.onion')
|
|
|
|
|
|
@pytest.mark.usefixtures('clean_domains')
|
|
def test_on_domain_removed():
|
|
"""Test removing a domain from the global list."""
|
|
DomainType('domain-type-tor', 'Tor Domain', 'torurl')
|
|
on_domain_added('tor', 'domain-type-tor', 'ddddd.onion')
|
|
on_domain_removed('tor', 'domain-type-tor', 'ddddd.onion')
|
|
with pytest.raises(KeyError):
|
|
DomainName.get('domain-tor-ddddd.onion')
|
|
|
|
# try to remove things that don't exist
|
|
on_domain_removed('', '')
|
|
with pytest.raises(KeyError):
|
|
on_domain_removed('', 'some-domain-type', 'x-unknown-name')
|