mirror of
https://github.com/sabnzbd/sabnzbd.git
synced 2026-09-22 02:45:20 -04:00
* Speed up tests with pytest-xdist * Ignore request failures when the server disappeared * Fix tests which modify module globals * Fix lang change leaking * Fix transaction compilation order breaking tests * Always load a clean config and fix related tests * No module globals * Fix other test classes assigning module level by making calls * Replace from sabnzbd.cfg import so monkeypatch works * More global poisoning * Fix dependant tests which worksteal breaks * More global vars * Drop loadscope until more failures are resolved * Due to how pytest-xdist is implemented, the -s/--capture=no option does not work * monkeypatch db_path * Also patch startup_done * loadscope
48 lines
1.6 KiB
Python
48 lines
1.6 KiB
Python
#!/usr/bin/python3 -OO
|
|
# Copyright 2007-2026 by The SABnzbd-Team (sabnzbd.org)
|
|
#
|
|
# This program is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License
|
|
# as published by the Free Software Foundation; either version 2
|
|
# of the License, or (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
"""
|
|
tests.test_utils.test_check_dir - Testing SABnzbd checkdir util
|
|
"""
|
|
|
|
import socket
|
|
|
|
import sabnzbd.cfg as cfg
|
|
from sabnzbd.getipaddress import addresslookup4, public_ipv4, local_ipv4, public_ipv6
|
|
from sabnzbd.misc import is_ipv4_addr, is_ipv6_addr
|
|
|
|
|
|
class TestGetIpAddress:
|
|
def test_addresslookup4(self):
|
|
address = addresslookup4(cfg.selftest_host())
|
|
assert address
|
|
for item in address:
|
|
assert isinstance(item[0], type(socket.AF_INET))
|
|
|
|
def test_public_ipv4(self):
|
|
if publicipv4 := public_ipv4():
|
|
assert is_ipv4_addr(publicipv4)
|
|
|
|
def test_local_ipv4(self):
|
|
if localipv4 := local_ipv4():
|
|
assert is_ipv4_addr(localipv4)
|
|
|
|
def test_public_ipv6(self):
|
|
if test_ipv6 := public_ipv6():
|
|
# Not all systems have IPv6
|
|
assert is_ipv6_addr(test_ipv6)
|