From 5a716ba39036db2fd0910d31f72d1140d3c8436e Mon Sep 17 00:00:00 2001 From: Francois Blackburn Date: Wed, 24 Jan 2024 10:56:51 -0500 Subject: [PATCH 1/2] add precommit checks --- .pre-commit-config.yaml | 23 +++++++++++++++++++++++ pyproject.toml | 4 ++++ 2 files changed, 27 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 80028368..fbe8e9d2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,3 +6,26 @@ repos: - id: flake8 # Required to make flake8 read from pyproject.toml for now :( additional_dependencies: ["flake8-pyproject"] + # Automatically update to modern python (as modern as allowed by your Python version) + - repo: https://github.com/asottile/pyupgrade + rev: v3.15.0 + hooks: + - id: pyupgrade + args: [--py39-plus] + # Automatically sort and format imports (in black compatible way) + - repo: https://github.com/pycqa/isort + rev: 5.12.0 + hooks: + - id: isort + args: [--filter-files] + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-toml + - repo: https://github.com/wazo-platform/wazo-git-hooks + rev: 1.1.1 + hooks: + - id: wazo-copyright-check diff --git a/pyproject.toml b/pyproject.toml index b2a227ff..f4bfb969 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,3 +10,7 @@ ignore = [ exclude = [ ".tox", ] + +[tool.isort] +profile = "black" +py_version = 39 From 59a407455a210ac7e39cec3353ef557f7dba3fe7 Mon Sep 17 00:00:00 2001 From: Francois Blackburn Date: Wed, 24 Jan 2024 10:58:15 -0500 Subject: [PATCH 2/2] apply precommit checks --- features/daily/bsfilter.feature | 4 ++-- features/daily/contact-center-stats.feature | 2 +- .../daily/integration-asterisk-queuelog.feature | 6 +++--- features/daily/switchboard.feature | 2 +- setup.py | 5 ++--- wazo_acceptance/assets/wazo-service-test.py | 4 ++-- wazo_acceptance/config.py | 7 +++---- wazo_acceptance/debug.py | 3 ++- wazo_acceptance/environment.py | 7 ++----- wazo_acceptance/helpers/bus.py | 6 +++--- wazo_acceptance/helpers/provd.py | 6 +----- wazo_acceptance/helpers/sip_config.py | 5 ++--- wazo_acceptance/helpers/sip_phone.py | 7 ++----- wazo_acceptance/helpers/utils.py | 3 +-- wazo_acceptance/main.py | 3 +-- wazo_acceptance/prerequisite.py | 7 ++----- wazo_acceptance/setup.py | 11 ++++------- wazo_acceptance/steps/__init__.py | 4 ++-- wazo_acceptance/steps/agent.py | 4 ++-- wazo_acceptance/steps/application.py | 13 +++---------- wazo_acceptance/steps/asterisk.py | 11 ++--------- wazo_acceptance/steps/auth.py | 9 ++------- wazo_acceptance/steps/backup.py | 3 ++- wazo_acceptance/steps/bus.py | 15 +++------------ wazo_acceptance/steps/call.py | 4 ++-- wazo_acceptance/steps/call_log.py | 10 ++-------- wazo_acceptance/steps/conference.py | 15 +++------------ wazo_acceptance/steps/coredump.py | 11 +++-------- wazo_acceptance/steps/fail2ban.py | 7 ++----- wazo_acceptance/steps/files.py | 13 +++---------- wazo_acceptance/steps/ha.py | 5 ++--- wazo_acceptance/steps/http.py | 10 ++-------- wazo_acceptance/steps/info.py | 3 +-- wazo_acceptance/steps/monit.py | 5 ++--- wazo_acceptance/steps/phone_call.py | 9 ++------- wazo_acceptance/steps/provd.py | 12 ++---------- wazo_acceptance/steps/queue.py | 4 ++-- wazo_acceptance/steps/queuelog.py | 4 ++-- wazo_acceptance/steps/stats.py | 8 ++++---- wazo_acceptance/steps/time.py | 5 ++--- wazo_acceptance/steps/user.py | 7 +++---- wazo_acceptance/steps/voicemail.py | 14 +++----------- wazo_acceptance/steps/wizard.py | 7 ++----- wazo_acceptance/sysutils.py | 5 ++--- 44 files changed, 96 insertions(+), 209 deletions(-) diff --git a/features/daily/bsfilter.feature b/features/daily/bsfilter.feature index 188d251f..8b333252 100644 --- a/features/daily/bsfilter.feature +++ b/features/daily/bsfilter.feature @@ -40,7 +40,7 @@ Feature: Boss Secretary Filter Then "Charlie Unknown" is ringing Then "Angel 001" is hungup When "Bad Guy" hangs up - + When "Angel 001" press function key "1" When I wait 2 seconds for the call processing When I wait 3 seconds to play message @@ -61,7 +61,7 @@ Feature: Boss Secretary Filter When I wait 2 seconds for the call processing Then "Charlie Unknown" is ringing Then "Angel 001" is hungup - + Scenario: Strategy "all" Given there are telephony users with infos: | firstname | lastname | exten | context | with_phone | diff --git a/features/daily/contact-center-stats.feature b/features/daily/contact-center-stats.feature index c06cf3e7..7a05b398 100644 --- a/features/daily/contact-center-stats.feature +++ b/features/daily/contact-center-stats.feature @@ -44,7 +44,7 @@ Feature: Stats generation | name | exten | context | agents | | stat-queue | 3521 | default | 1003 | Given there are no hour change in the next 30 seconds - + # First cycle When I log agent "1003" from API When I pause agent "1003" diff --git a/features/daily/integration-asterisk-queuelog.feature b/features/daily/integration-asterisk-queuelog.feature index 8b939bba..73369882 100644 --- a/features/daily/integration-asterisk-queuelog.feature +++ b/features/daily/integration-asterisk-queuelog.feature @@ -178,7 +178,7 @@ Feature: Stats generation | firstname | lastname | exten | context | with_phone | agent_number | | Agent | 012 | 1512 | default | yes | 012 | Given there are queues with infos: - | name | exten | context | timeout | option_timeout | agents | + | name | exten | context | timeout | option_timeout | agents | | q12 | 3512 | default | 10 | 5 | 012 | Given agent "012" is logged When chan_test calls "3512@default" with caller ID name "3512-1" @@ -200,7 +200,7 @@ Feature: Stats generation | firstname | lastname | exten | context | with_phone | agent_number | | Agent | 014 | 1514 | default | yes | 014 | Given there are queues with infos: - | name | exten | context | timeout | option_timeout | agents | + | name | exten | context | timeout | option_timeout | agents | | q14 | 3514 | default | 10 | 5 | 014 | Given agent "014" is logged When I pause agent "014" @@ -214,7 +214,7 @@ Feature: Stats generation | firstname | lastname | exten | context | with_phone | agent_number | | Agent | 015 | 1515 | default | yes | 015 | Given there are queues with infos: - | name | exten | context | option_wrapuptime | agents | + | name | exten | context | option_wrapuptime | agents | | q15 | 3515 | default | 5 | 015 | Given agent "015" is logged When chan_test calls "3515@default" with id "3515-1" diff --git a/features/daily/switchboard.feature b/features/daily/switchboard.feature index 99cbd735..d0fd8cd6 100644 --- a/features/daily/switchboard.feature +++ b/features/daily/switchboard.feature @@ -74,6 +74,6 @@ Feature: Switchboards Then switchboard "no-timeout" has "i-will-not-timeout-1" in queued calls Then switchboard "no-fallback" has "i-will-not-timeout-2" in queued calls - # Should be Caller ID "i-will-be-transferred-to-switchboard", + # Should be Caller ID "i-will-be-transferred-to-switchboard", # but is "Reception Clerk" due to an Asterisk bug on Local channels Then switchboard "transfer-destination" has "Reception Clerk" in queued calls diff --git a/setup.py b/setup.py index ba526455..1ba69735 100755 --- a/setup.py +++ b/setup.py @@ -1,9 +1,8 @@ #!/usr/bin/env python3 -# Copyright 2019 The Wazo Authors (see the AUTHORS file) +# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later -from setuptools import setup -from setuptools import find_packages +from setuptools import find_packages, setup setup( name='wazo-acceptance', diff --git a/wazo_acceptance/assets/wazo-service-test.py b/wazo_acceptance/assets/wazo-service-test.py index d3f0a4f9..ffa0aa8d 100755 --- a/wazo_acceptance/assets/wazo-service-test.py +++ b/wazo_acceptance/assets/wazo-service-test.py @@ -1,9 +1,9 @@ #!/usr/bin/env python3 -# Copyright 2016-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2016-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later -import subprocess import re +import subprocess BASE_SERVICES = [ 'asterisk', diff --git a/wazo_acceptance/config.py b/wazo_acceptance/config.py index d0df8a71..4325b51b 100644 --- a/wazo_acceptance/config.py +++ b/wazo_acceptance/config.py @@ -1,13 +1,12 @@ -# Copyright 2014-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2014-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later import logging import os - from copy import deepcopy -from xivo.config_helper import parse_config_dir -from xivo.chain_map import ChainMap +from xivo.chain_map import ChainMap +from xivo.config_helper import parse_config_dir logger = logging.getLogger(__name__) diff --git a/wazo_acceptance/debug.py b/wazo_acceptance/debug.py index 8191a5e4..d92cf582 100644 --- a/wazo_acceptance/debug.py +++ b/wazo_acceptance/debug.py @@ -1,7 +1,8 @@ -# Copyright 2015-2022 The Wazo Authors (see the AUTHORS file) +# Copyright 2015-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later import logging + import requests loggers = { diff --git a/wazo_acceptance/environment.py b/wazo_acceptance/environment.py index baed7725..a6817cb5 100644 --- a/wazo_acceptance/environment.py +++ b/wazo_acceptance/environment.py @@ -1,4 +1,4 @@ -# Copyright 2013-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later from __future__ import annotations @@ -9,10 +9,7 @@ from xivo.pubsub import Pubsub from xivo.xivo_logging import setup_logging as wazo_setup_logging -from . import ( - debug, - setup -) +from . import debug, setup from .config import load_config logger = logging.getLogger('acceptance') diff --git a/wazo_acceptance/helpers/bus.py b/wazo_acceptance/helpers/bus.py index 002ad7f9..16ddd605 100644 --- a/wazo_acceptance/helpers/bus.py +++ b/wazo_acceptance/helpers/bus.py @@ -1,13 +1,13 @@ -# Copyright 2019-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later from __future__ import annotations -import logging import functools +import logging import queue import threading - from contextlib import contextmanager + from hamcrest import assert_that, has_entries from wazo_test_helpers import until diff --git a/wazo_acceptance/helpers/provd.py b/wazo_acceptance/helpers/provd.py index 32ba3792..05b42c52 100644 --- a/wazo_acceptance/helpers/provd.py +++ b/wazo_acceptance/helpers/provd.py @@ -2,11 +2,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later import requests -from hamcrest import ( - assert_that, - is_, -) - +from hamcrest import assert_that, is_ from wazo_provd_client import operation from wazo_provd_client.exceptions import ProvdError from wazo_test_helpers import until diff --git a/wazo_acceptance/helpers/sip_config.py b/wazo_acceptance/helpers/sip_config.py index b26fc762..12bfdeb8 100644 --- a/wazo_acceptance/helpers/sip_config.py +++ b/wazo_acceptance/helpers/sip_config.py @@ -1,9 +1,8 @@ -# Copyright 2018-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2018-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later -from collections import namedtuple import subprocess - +from collections import namedtuple SIPConfig = namedtuple('SIPConfig', ('sip_port', 'rtp_port', 'sip_name', 'sip_passwd', 'sip_host')) diff --git a/wazo_acceptance/helpers/sip_phone.py b/wazo_acceptance/helpers/sip_phone.py index c763a53b..4049fdf5 100644 --- a/wazo_acceptance/helpers/sip_phone.py +++ b/wazo_acceptance/helpers/sip_phone.py @@ -1,4 +1,4 @@ -# Copyright 2015-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2015-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later import datetime @@ -6,10 +6,7 @@ import sys import time -from linphonelib import ( - LinphoneException, - Session, -) +from linphonelib import LinphoneException, Session from linphonelib.commands import CallStatus, RegisterStatus logger = logging.getLogger('linphone') diff --git a/wazo_acceptance/helpers/utils.py b/wazo_acceptance/helpers/utils.py index cced62ef..927a1bad 100644 --- a/wazo_acceptance/helpers/utils.py +++ b/wazo_acceptance/helpers/utils.py @@ -1,9 +1,8 @@ -# Copyright 2020-2021 The Wazo Authors (see the AUTHORS file) +# Copyright 2020-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later import random import string - from contextlib import contextmanager diff --git a/wazo_acceptance/main.py b/wazo_acceptance/main.py index 438c08c9..bd037321 100644 --- a/wazo_acceptance/main.py +++ b/wazo_acceptance/main.py @@ -1,4 +1,4 @@ -# Copyright 2014-2020 The Wazo Authors (see the AUTHORS file) +# Copyright 2014-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later import argparse @@ -10,7 +10,6 @@ from . import prerequisite from .config import load_config - logger = logging.getLogger(__name__) diff --git a/wazo_acceptance/prerequisite.py b/wazo_acceptance/prerequisite.py index 9cc46888..089f9cb1 100644 --- a/wazo_acceptance/prerequisite.py +++ b/wazo_acceptance/prerequisite.py @@ -1,4 +1,4 @@ -# Copyright 2013-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later import logging @@ -7,10 +7,7 @@ from requests.exceptions import HTTPError from xivo.pubsub import Pubsub -from . import ( - debug, - setup, -) +from . import debug, setup from .config import load_config logger = logging.getLogger(__name__) diff --git a/wazo_acceptance/setup.py b/wazo_acceptance/setup.py index 96b92ae7..f1cecd75 100644 --- a/wazo_acceptance/setup.py +++ b/wazo_acceptance/setup.py @@ -1,13 +1,12 @@ -# Copyright 2015-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2015-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later -import ari import logging +import ari from requests.exceptions import HTTPError - -from wazo_amid_client import Client as AmidClient from wazo_agentd_client import Client as AgentdClient +from wazo_amid_client import Client as AmidClient from wazo_auth_client import Client as AuthClient from wazo_call_logd_client import Client as CallLogdClient from wazo_calld_client import Client as CalldClient @@ -18,9 +17,7 @@ from wazo_setupd_client import Client as SetupdClient from wazo_websocketd_client import Client as WebsocketdClient -from . import auth -from . import debug -from . import helpers +from . import auth, debug, helpers from .phone_register import PhoneRegister from .ssh import SSHClient from .sysutils import RemoteSysUtils diff --git a/wazo_acceptance/steps/__init__.py b/wazo_acceptance/steps/__init__.py index 8380d068..8afae901 100644 --- a/wazo_acceptance/steps/__init__.py +++ b/wazo_acceptance/steps/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2019-2022 The Wazo Authors (see the AUTHORS file) +# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later from .agent import * # noqa @@ -10,8 +10,8 @@ from .bus import * # noqa from .call import * # noqa from .call_filter import * # noqa -from .call_permission import * # noqa from .call_log import * # noqa +from .call_permission import * # noqa from .conference import * # noqa from .coredump import * # noqa from .debian import * # noqa diff --git a/wazo_acceptance/steps/agent.py b/wazo_acceptance/steps/agent.py index 607dd418..0dc2520d 100644 --- a/wazo_acceptance/steps/agent.py +++ b/wazo_acceptance/steps/agent.py @@ -1,7 +1,7 @@ -# Copyright 2019-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later -from behave import given, when, then +from behave import given, then, when from hamcrest import assert_that, not_ diff --git a/wazo_acceptance/steps/application.py b/wazo_acceptance/steps/application.py index dcdbdc29..8eb47a6f 100644 --- a/wazo_acceptance/steps/application.py +++ b/wazo_acceptance/steps/application.py @@ -1,15 +1,8 @@ -# Copyright 2019-2021 The Wazo Authors (see the AUTHORS file) +# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later -from behave import ( - given, - then, - when, -) -from hamcrest import ( - assert_that, - equal_to, -) +from behave import given, then, when +from hamcrest import assert_that, equal_to from wazo_test_helpers import until diff --git a/wazo_acceptance/steps/asterisk.py b/wazo_acceptance/steps/asterisk.py index d92dd460..68555146 100644 --- a/wazo_acceptance/steps/asterisk.py +++ b/wazo_acceptance/steps/asterisk.py @@ -1,15 +1,8 @@ -# Copyright 2019-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later from behave import then - -from hamcrest import ( - assert_that, - equal_to, - has_entries, - has_item, - not_, -) +from hamcrest import assert_that, equal_to, has_entries, has_item, not_ from wazo_test_helpers import until FUNCKEYS_EXTEN = { diff --git a/wazo_acceptance/steps/auth.py b/wazo_acceptance/steps/auth.py index 98b42b18..0b497edb 100644 --- a/wazo_acceptance/steps/auth.py +++ b/wazo_acceptance/steps/auth.py @@ -1,13 +1,8 @@ -# Copyright 2019-2022 The Wazo Authors (see the AUTHORS file) +# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later +from behave import given, then, when from hamcrest import assert_that, is_not, none -from behave import ( - given, - then, - when, -) - from wazo_auth_client import Client as AuthClient diff --git a/wazo_acceptance/steps/backup.py b/wazo_acceptance/steps/backup.py index 77a6571e..7d3c17ca 100644 --- a/wazo_acceptance/steps/backup.py +++ b/wazo_acceptance/steps/backup.py @@ -1,7 +1,8 @@ -# Copyright 2013-2019 The Wazo Authors (see the AUTHORS file) +# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later from behave import given, when + from .. import auth BACKUP_MANAGER = 'wazo-backup-manager' diff --git a/wazo_acceptance/steps/bus.py b/wazo_acceptance/steps/bus.py index af594f09..5bff8a3f 100644 --- a/wazo_acceptance/steps/bus.py +++ b/wazo_acceptance/steps/bus.py @@ -1,21 +1,12 @@ -# Copyright 2019-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later import collections import queue import time -from behave import ( - given, - then, -) -from hamcrest import ( - assert_that, - empty, - has_entries, - has_key, -) - +from behave import given, then +from hamcrest import assert_that, empty, has_entries, has_key from wazo_test_helpers import until diff --git a/wazo_acceptance/steps/call.py b/wazo_acceptance/steps/call.py index 405b5d39..033bb23b 100644 --- a/wazo_acceptance/steps/call.py +++ b/wazo_acceptance/steps/call.py @@ -1,8 +1,8 @@ -# Copyright 2020-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2020-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later from behave import then, when -from hamcrest import assert_that, is_, equal_to +from hamcrest import assert_that, equal_to, is_ from wazo_test_helpers import until diff --git a/wazo_acceptance/steps/call_log.py b/wazo_acceptance/steps/call_log.py index 6bcfe766..59918add 100644 --- a/wazo_acceptance/steps/call_log.py +++ b/wazo_acceptance/steps/call_log.py @@ -1,14 +1,8 @@ -# Copyright 2013-2021 The Wazo Authors (see the AUTHORS file) +# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later from behave import then -from hamcrest import ( - assert_that, - all_of, - greater_than, - has_entries, - less_than, -) +from hamcrest import all_of, assert_that, greater_than, has_entries, less_than from wazo_test_helpers import until diff --git a/wazo_acceptance/steps/conference.py b/wazo_acceptance/steps/conference.py index 49592dba..90123207 100644 --- a/wazo_acceptance/steps/conference.py +++ b/wazo_acceptance/steps/conference.py @@ -1,17 +1,8 @@ -# Copyright 2019-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later -from hamcrest import ( - assert_that, - contains_inanyorder, - has_entries, -) - -from behave import ( - given, - then, - when, -) +from behave import given, then, when +from hamcrest import assert_that, contains_inanyorder, has_entries @given('there are conference rooms with infos') diff --git a/wazo_acceptance/steps/coredump.py b/wazo_acceptance/steps/coredump.py index 3b75541e..985f9098 100644 --- a/wazo_acceptance/steps/coredump.py +++ b/wazo_acceptance/steps/coredump.py @@ -1,15 +1,10 @@ -# Copyright 2019-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later import os -from behave import when, then -from hamcrest import ( - assert_that, - empty, - is_, - is_not, -) +from behave import then, when +from hamcrest import assert_that, empty, is_, is_not @when('I generate a core dump') diff --git a/wazo_acceptance/steps/fail2ban.py b/wazo_acceptance/steps/fail2ban.py index 99ab6781..570ba187 100644 --- a/wazo_acceptance/steps/fail2ban.py +++ b/wazo_acceptance/steps/fail2ban.py @@ -1,11 +1,8 @@ -# Copyright 2016-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2016-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later from behave import then -from hamcrest import ( - assert_that, - has_item, -) +from hamcrest import assert_that, has_item _FAIL2BAN_REGEX_ARGS = { 'wazo-provd': { diff --git a/wazo_acceptance/steps/files.py b/wazo_acceptance/steps/files.py index 2adbe58f..3ed5e766 100644 --- a/wazo_acceptance/steps/files.py +++ b/wazo_acceptance/steps/files.py @@ -1,18 +1,11 @@ -# Copyright 2019-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later import os import re -from behave import then, given -from hamcrest import ( - assert_that, - contains_string, - equal_to, - is_, - is_not, - none, -) +from behave import given, then +from hamcrest import assert_that, contains_string, equal_to, is_, is_not, none AUTOPROV_WIZARD_FILE = '/etc/asterisk/pjsip.d/05-autoprov-wizard.conf' BACKUP_DIR = '/var/backups/wazo' diff --git a/wazo_acceptance/steps/ha.py b/wazo_acceptance/steps/ha.py index f8a0ca47..053edd85 100644 --- a/wazo_acceptance/steps/ha.py +++ b/wazo_acceptance/steps/ha.py @@ -1,11 +1,10 @@ -# Copyright 2019-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later import string - from datetime import datetime, timezone -from behave import given, when, then, step +from behave import given, step, then, when from wazo_test_helpers import until from wazo_acceptance import auth, setup diff --git a/wazo_acceptance/steps/http.py b/wazo_acceptance/steps/http.py index 78adad0a..647deda4 100644 --- a/wazo_acceptance/steps/http.py +++ b/wazo_acceptance/steps/http.py @@ -1,15 +1,9 @@ -# Copyright 2017-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2017-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later import requests - from behave import then - -from hamcrest import ( - assert_that, - equal_to, - not_, -) +from hamcrest import assert_that, equal_to, not_ @then('"{method}" "{url_path}" does not answer 404') diff --git a/wazo_acceptance/steps/info.py b/wazo_acceptance/steps/info.py index d5b455c0..1e99a827 100644 --- a/wazo_acceptance/steps/info.py +++ b/wazo_acceptance/steps/info.py @@ -1,9 +1,8 @@ -# Copyright 2019-2021 The Wazo Authors (see the AUTHORS file) +# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later from behave import then from hamcrest import assert_that, has_entries - from wazo_test_helpers.hamcrest.uuid_ import uuid_ diff --git a/wazo_acceptance/steps/monit.py b/wazo_acceptance/steps/monit.py index 60565f1b..bafbb4a1 100644 --- a/wazo_acceptance/steps/monit.py +++ b/wazo_acceptance/steps/monit.py @@ -1,9 +1,8 @@ -# Copyright 2019-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later -from wazo_test_helpers import until - from behave import then +from wazo_test_helpers import until @then('monit monitors the service "{process_name}"') diff --git a/wazo_acceptance/steps/phone_call.py b/wazo_acceptance/steps/phone_call.py index 5ed84fac..06463c94 100644 --- a/wazo_acceptance/steps/phone_call.py +++ b/wazo_acceptance/steps/phone_call.py @@ -1,16 +1,11 @@ -# Copyright 2013-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later import time from ari.exceptions import ARINotFound from behave import step, then, when -from hamcrest import ( - assert_that, - has_entries, - has_length, - not_, -) +from hamcrest import assert_that, has_entries, has_length, not_ from wazo_test_helpers import until CHAN_PREFIX = 'PJSIP' diff --git a/wazo_acceptance/steps/provd.py b/wazo_acceptance/steps/provd.py index 870e7e5c..02f28024 100644 --- a/wazo_acceptance/steps/provd.py +++ b/wazo_acceptance/steps/provd.py @@ -1,18 +1,10 @@ -# Copyright 2013-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later import json from behave import given, then -from hamcrest import ( - all_of, - any_of, - assert_that, - has_entries, - has_entry, - has_key, - not_, -) +from hamcrest import all_of, any_of, assert_that, has_entries, has_entry, has_key, not_ STABLE_URL = 'http://provd.wazo.community/plugins/2/stable/' diff --git a/wazo_acceptance/steps/queue.py b/wazo_acceptance/steps/queue.py index d8b9b90c..d2402ff0 100644 --- a/wazo_acceptance/steps/queue.py +++ b/wazo_acceptance/steps/queue.py @@ -1,7 +1,7 @@ -# Copyright 2019-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later -from behave import when, given +from behave import given, when @given('there are queues with infos') diff --git a/wazo_acceptance/steps/queuelog.py b/wazo_acceptance/steps/queuelog.py index f7551613..0262800e 100644 --- a/wazo_acceptance/steps/queuelog.py +++ b/wazo_acceptance/steps/queuelog.py @@ -1,7 +1,7 @@ -# Copyright 2020 The Wazo Authors (see the AUTHORS file) +# Copyright 2020-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later -from behave import given, when, then +from behave import given, then, when @given('there is no queue_log for queue "{queue_name}"') diff --git a/wazo_acceptance/steps/stats.py b/wazo_acceptance/steps/stats.py index 038520db..c7405f9f 100644 --- a/wazo_acceptance/steps/stats.py +++ b/wazo_acceptance/steps/stats.py @@ -1,12 +1,12 @@ -# Copyright 2020-2022 The Wazo Authors (see the AUTHORS file) +# Copyright 2020-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later import logging -import pytz - -from behave import when, then from datetime import datetime, timedelta, timezone +import pytz +from behave import then, when + logger = logging.getLogger('acceptance') diff --git a/wazo_acceptance/steps/time.py b/wazo_acceptance/steps/time.py index 0b70ff06..fd5293a8 100644 --- a/wazo_acceptance/steps/time.py +++ b/wazo_acceptance/steps/time.py @@ -1,11 +1,10 @@ -# Copyright 2020-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2020-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later import time - -from behave import given, when from datetime import datetime, timedelta +from behave import given, when from wazo_test_helpers import until diff --git a/wazo_acceptance/steps/user.py b/wazo_acceptance/steps/user.py index 94277af6..a89c5abf 100644 --- a/wazo_acceptance/steps/user.py +++ b/wazo_acceptance/steps/user.py @@ -1,12 +1,11 @@ -# Copyright 2019-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later -import time import string +import time -from behave import given, then, when, step +from behave import given, step, then, when from hamcrest import assert_that, equal_to, is_ - from wazo_test_helpers import until diff --git a/wazo_acceptance/steps/voicemail.py b/wazo_acceptance/steps/voicemail.py index 1a867a4c..e019b1e3 100644 --- a/wazo_acceptance/steps/voicemail.py +++ b/wazo_acceptance/steps/voicemail.py @@ -1,18 +1,10 @@ -# Copyright 2019-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later import time -from hamcrest import ( - assert_that, - contains_inanyorder, - empty, - has_entries, -) -from behave import ( - then, - when, -) +from behave import then, when +from hamcrest import assert_that, contains_inanyorder, empty, has_entries @when('a message is left on voicemail "{vm_number}@{vm_context}" by "{cid_name}"') diff --git a/wazo_acceptance/steps/wizard.py b/wazo_acceptance/steps/wizard.py index 80c43c2d..53e49f70 100644 --- a/wazo_acceptance/steps/wizard.py +++ b/wazo_acceptance/steps/wizard.py @@ -1,11 +1,8 @@ -# Copyright 2022 The Wazo Authors (see the AUTHORS file) +# Copyright 2022-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later from behave import then -from hamcrest import ( - assert_that, - has_entries, -) +from hamcrest import assert_that, has_entries @then('the wizard is correctly setup') diff --git a/wazo_acceptance/sysutils.py b/wazo_acceptance/sysutils.py index 6763c524..59987977 100644 --- a/wazo_acceptance/sysutils.py +++ b/wazo_acceptance/sysutils.py @@ -1,9 +1,8 @@ -# Copyright 2013-2023 The Wazo Authors (see the AUTHORS file) +# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later -import time import datetime - +import time from email.utils import parsedate