Skip to content

Commit

Permalink
Refactor import order in test modules
Browse files Browse the repository at this point in the history
Cleaned up the order of imports in various test modules. This process specifically prioritizes standard library imports, followed by related third party imports, and local application/library specific imports.
  • Loading branch information
saschadoemer committed May 2, 2024
1 parent 7251045 commit 0263758
Show file tree
Hide file tree
Showing 19 changed files with 59 additions and 58 deletions.
2 changes: 1 addition & 1 deletion tests/agrirouter/common/onboarding.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from agrirouter.service.onboarding import OnboardingService
from agrirouter.service.onboarding import OnboardParameters
from agrirouter.service.onboarding import OnboardResponse
from agrirouter.service.onboarding import OnboardingService
from tests.agrirouter.data.applications import CommunicationUnit


Expand Down
6 changes: 3 additions & 3 deletions tests/agrirouter/fixtures/update_http_onboard_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import pytest

from agrirouter.api.enums import CapabilityType, CapabilityDirectionType
from agrirouter.api.enums import CertificateTypes, Gateways
from agrirouter.api.env import Qa
from agrirouter.generated.messaging.request.payload.endpoint.capabilities_pb2 import CapabilitySpecification
from agrirouter.service.parameter.messaging import CapabilitiesParameters
from agrirouter.service.messaging import CapabilitiesService
from agrirouter.service.messaging import HttpMessagingService
from agrirouter.service.messaging.http import FetchMessageService
from agrirouter.service.messaging import CapabilitiesService
from agrirouter.api.enums import CertificateTypes, Gateways
from agrirouter.service.onboarding import OnboardResponse
from agrirouter.service.parameter.messaging import CapabilitiesParameters
from agrirouter.util.uuid_util import UUIDUtil
from tests.agrirouter.common.onboarding import onboard_communication_unit
from tests.agrirouter.common.sleeper import Sleeper
Expand Down
10 changes: 5 additions & 5 deletions tests/agrirouter/fixtures/update_mqtt_onboard_responses.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import pytest

from agrirouter.api.enums import CapabilityType, CapabilityDirectionType
from agrirouter.api.enums import CertificateTypes, Gateways
from agrirouter.api.env import Qa
from agrirouter.generated.messaging.request.payload.endpoint.capabilities_pb2 import CapabilitySpecification
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.api.messages import OutboxMessage
from agrirouter.service.parameter.messaging import CapabilitiesParameters
from agrirouter.service.messaging import MqttMessagingService
from agrirouter.generated.messaging.request.payload.endpoint.capabilities_pb2 import CapabilitySpecification
from agrirouter.service.messaging import CapabilitiesService
from agrirouter.service.messaging import MqttMessagingService
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.service.messaging.sequence_numbers import SequenceNumberService
from agrirouter.api.enums import CertificateTypes, Gateways
from agrirouter.service.parameter.messaging import CapabilitiesParameters
from agrirouter.util.uuid_util import UUIDUtil
from tests.agrirouter.common.onboarding import onboard_communication_unit
from tests.agrirouter.common.sleeper import Sleeper
Expand Down
2 changes: 1 addition & 1 deletion tests/agrirouter/internal/auth/test_auth_dto.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Tests agrirouter/auth/authorization.py"""
import pytest

from agrirouter.service.dto.request.authorization import AuthorizationToken
from agrirouter.api.exceptions import WrongField
from agrirouter.service.dto.request.authorization import AuthorizationToken


class TestAuthorizationToken:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Test src/env/environmental_services.py"""

from src.agrirouter.api.env import Qa, Production
from src.agrirouter.env.environmental_services import EnvironmentalService

from src.agrirouter.api.env import Qa, Production


def test_arclient_set_env():
assert EnvironmentalService(env=Qa())._set_env(Qa()) is None
Expand Down
1 change: 0 additions & 1 deletion tests/agrirouter/internal/messaging/test_decode.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import json

from agrirouter.generated.messaging.response.response_pb2 import ResponseEnvelope

from agrirouter.service.messaging.decoding import DecodingService

MESSAGING_RESULT = b'[{"sensorAlternateId":"185cd97b-ed0b-4e75-a6e2-6be1cdd38a06","capabilityAlternateId":"bbe9f361-b551-48d9-9fca-1b4dc768287c","command":{"message":"XwjIARAKGiQ5NWUzNWE0Zi1jNWM4LTQ1NDEtODE4OS03NmJlMzM0OTc0NDUiJDUzNzYyM2ZjLWY2NmYtNDc5Yi1hMmJhLWVjZjNlNWM3ZjhlMCoMCNTV5YsGEICI8LIDzQIKygIKTnR5cGVzLmFncmlyb3V0ZXIuY29tL2Fncmlyb3V0ZXIucmVzcG9uc2UucGF5bG9hZC5hY2NvdW50Lkxpc3RFbmRwb2ludHNSZXNwb25zZRL3AQp4CiRkNzA0YTQ0My05OWY3LTQ3YjQtYmU1NS1lMmZhMDk2ODllYmUSJFB5dGhvblNES19kZXYgLSAyMDIxLTEwLTI1LCAxMDo1MToxOBoLYXBwbGljYXRpb24iBmFjdGl2ZTIVdXJuOm15YXBwOnNucjAwMDAzMjM0CnsKJDE4NWNkOTdiLWVkMGItNGU3NS1hNmUyLTZiZTFjZGQzOGEwNhIkUHl0aG9uU0RLX2RldiAtIDIwMjEtMTAtMjEsIDIxOjQxOjI0GgthcHBsaWNhdGlvbiIGYWN0aXZlMhh1cm46bXlhcHA6c25yMDAwMDMyMzRzZGY="}}]' # noqa
Expand Down
4 changes: 2 additions & 2 deletions tests/agrirouter/internal/onboarding/test_onboarding.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import pytest

from agrirouter.api.enums import Gateways, CertificateTypes
from agrirouter.api.env import Qa
from agrirouter.api.exceptions import WrongCertificationType, WrongGateWayType
from agrirouter.api.enums import Gateways, CertificateTypes
from agrirouter.service.onboarding import SecuredOnboardingService
from agrirouter.service.onboarding import OnboardParameters
from agrirouter.service.onboarding import SecuredOnboardingService
from tests.agrirouter.common.constants import PUBLIC_KEY, PRIVATE_KEY, APPLICATION_ID


Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Test src/onboarding/messaging.py"""
from agrirouter.api.env import Qa
from agrirouter.api.enums import Gateways, CertificateTypes
from agrirouter.service.onboarding import SecuredOnboardingService
from agrirouter.api.env import Qa
from agrirouter.service.onboarding import OnboardParameters
from agrirouter.service.onboarding import SecuredOnboardingService
from tests.agrirouter.common.constants import APPLICATION_ID, PUBLIC_KEY, PRIVATE_KEY


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

import pytest

from agrirouter.generated.messaging.request.payload.endpoint.capabilities_pb2 import CapabilitySpecification
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.api.enums import CapabilityDirectionType
from agrirouter.api.enums import CapabilityType
from agrirouter.api.messages import OutboxMessage
from agrirouter.service.parameter.messaging import CapabilitiesParameters
from agrirouter.service.messaging import MqttMessagingService
from agrirouter.generated.messaging.request.payload.endpoint.capabilities_pb2 import CapabilitySpecification
from agrirouter.service.messaging import CapabilitiesService
from agrirouter.service.messaging import MqttMessagingService
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.service.messaging.sequence_numbers import SequenceNumberService
from agrirouter.service.parameter.messaging import CapabilitiesParameters
from agrirouter.util.uuid_util import UUIDUtil
from tests.agrirouter.common.sleeper import Sleeper
from tests.agrirouter.data.applications import CommunicationUnit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
import pytest

from agrirouter.api.enums import CapabilityType
from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.api.messages import OutboxMessage
from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope
from agrirouter.service.dto.messaging import SendMessageParameters
from agrirouter.service.parameter.messaging import FeedDeleteParameters, FeedConfirmParameters
from agrirouter.service.messaging import MqttMessagingService
from agrirouter.service.messaging import SendMessageService, FeedDeleteService, FeedConfirmService
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.service.messaging.sequence_numbers import SequenceNumberService
from agrirouter.service.onboarding import OnboardResponse
from agrirouter.service.parameter.messaging import FeedDeleteParameters, FeedConfirmParameters
from agrirouter.util.uuid_util import UUIDUtil
from tests.agrirouter.common.data_provider import DataProvider
from tests.agrirouter.common.sleeper import Sleeper
Expand Down Expand Up @@ -273,7 +273,8 @@ def _inner_function(client, userdata, msg):
outbox_message = OutboxMessage()
outbox_message.json_deserialize(msg.payload.decode().replace("'", '"'))
decoded_message = DecodingService.decode_response(outbox_message.command.message.encode())
feed_confirm_details_for_empty_messages = DecodingService.decode_details(decoded_message.response_payload.details)
feed_confirm_details_for_empty_messages = DecodingService.decode_details(
decoded_message.response_payload.details)
self._log.info(f"Feed confirm details for empty messages: {feed_confirm_details_for_empty_messages}")
assert decoded_message.response_envelope.response_code == 200
for _message in feed_confirm_details_for_empty_messages.messages:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import pytest

from agrirouter.api.enums import CapabilityType
from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.api.messages import OutboxMessage
from agrirouter.service.parameter.messaging import FeedDeleteParameters
from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope
from agrirouter.service.messaging import MqttMessagingService
from agrirouter.service.messaging import SendMessageService, SendMessageParameters, FeedDeleteService
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.service.messaging.sequence_numbers import SequenceNumberService
from agrirouter.service.parameter.messaging import FeedDeleteParameters
from agrirouter.util.utc_time_util import UtcTimeUtil
from agrirouter.util.uuid_util import UUIDUtil
from tests.agrirouter.common.data_provider import DataProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

import pytest

from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.api.enums import CapabilityType, CapabilityDirectionType
from agrirouter.api.messages import OutboxMessage
from agrirouter.service.parameter.messaging import ListEndpointsParameters
from agrirouter.service.messaging import MqttMessagingService
from agrirouter.service.messaging import ListEndpointsService
from agrirouter.service.messaging import MqttMessagingService
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.service.messaging.sequence_numbers import SequenceNumberService
from agrirouter.service.parameter.messaging import ListEndpointsParameters
from agrirouter.util.uuid_util import UUIDUtil
from tests.agrirouter.common.sleeper import Sleeper
from tests.agrirouter.data.identifier import Identifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

import pytest

from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.api.enums import CapabilityType
from agrirouter.api.messages import OutboxMessage
from agrirouter.service.parameter.messaging import FeedDeleteParameters
from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope
from agrirouter.service.messaging import MqttMessagingService
from agrirouter.service.messaging import SendMessageService, SendMessageParameters, FeedDeleteService
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.service.messaging.sequence_numbers import SequenceNumberService
from agrirouter.service.onboarding import OnboardResponse
from agrirouter.service.parameter.messaging import FeedDeleteParameters
from agrirouter.util.uuid_util import UUIDUtil
from tests.agrirouter.common.data_provider import DataProvider
from tests.agrirouter.common.sleeper import Sleeper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
import pytest

from agrirouter.api.enums import CapabilityType
from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.api.messages import OutboxMessage
from agrirouter.service.parameter.messaging import FeedDeleteParameters, QueryHeaderParameters
from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope
from agrirouter.service.messaging import MqttMessagingService
from agrirouter.service.messaging import SendMessageService, SendMessageParameters, FeedDeleteService, \
QueryHeaderService
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.service.messaging.sequence_numbers import SequenceNumberService
from agrirouter.service.onboarding import OnboardResponse
from agrirouter.service.parameter.messaging import FeedDeleteParameters, QueryHeaderParameters
from agrirouter.util.utc_time_util import UtcTimeUtil
from agrirouter.util.uuid_util import UUIDUtil
from tests.agrirouter.common.data_provider import DataProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
import pytest

from agrirouter.api.enums import CapabilityType
from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.api.messages import OutboxMessage
from agrirouter.service.parameter.messaging import FeedDeleteParameters, QueryMessageParameters
from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope
from agrirouter.service.messaging import MqttMessagingService
from agrirouter.service.messaging import SendMessageService, SendMessageParameters, FeedDeleteService, \
QueryMessagesService
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.service.messaging.sequence_numbers import SequenceNumberService
from agrirouter.service.onboarding import OnboardResponse
from agrirouter.service.parameter.messaging import FeedDeleteParameters, QueryMessageParameters
from agrirouter.util.utc_time_util import UtcTimeUtil
from agrirouter.util.uuid_util import UUIDUtil
from tests.agrirouter.common.data_provider import DataProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
import pytest

from agrirouter.api.enums import CapabilityType, TechnicalMessageType
from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.service.messaging.encoding import EncodingService
from agrirouter.api.messages import OutboxMessage
from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope
from agrirouter.service.dto.messaging import ChunkedMessageParameters
from agrirouter.service.parameter.messaging import FeedDeleteParameters, MessageHeaderParameters, \
MessagePayloadParameters, QueryHeaderParameters
from agrirouter.service.messaging import MqttMessagingService
from agrirouter.service.messaging import FeedDeleteService, SendChunkedMessageService, QueryHeaderService
from agrirouter.service.messaging import MqttMessagingService
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.service.messaging.encoding import EncodingService
from agrirouter.service.messaging.sequence_numbers import SequenceNumberService
from agrirouter.service.onboarding import OnboardResponse
from agrirouter.service.parameter.messaging import FeedDeleteParameters, MessageHeaderParameters, \
MessagePayloadParameters, QueryHeaderParameters
from agrirouter.util.uuid_util import UUIDUtil
from tests.agrirouter.common.data_provider import DataProvider
from tests.agrirouter.common.sleeper import Sleeper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
import pytest

from agrirouter.api.enums import CapabilityType, TechnicalMessageType
from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.service.messaging.encoding import EncodingService
from agrirouter.api.messages import OutboxMessage
from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope
from agrirouter.service.dto.messaging import ChunkedMessageParameters
from agrirouter.service.parameter.messaging import FeedDeleteParameters, MessageHeaderParameters, \
MessagePayloadParameters
from agrirouter.service.messaging import MqttMessagingService
from agrirouter.service.messaging import FeedDeleteService, SendChunkedMessageService
from agrirouter.service.messaging import MqttMessagingService
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.service.messaging.encoding import EncodingService
from agrirouter.service.messaging.sequence_numbers import SequenceNumberService
from agrirouter.service.onboarding import OnboardResponse
from agrirouter.service.parameter.messaging import FeedDeleteParameters, MessageHeaderParameters, \
MessagePayloadParameters
from agrirouter.util.uuid_util import UUIDUtil
from tests.agrirouter.common.data_provider import DataProvider
from tests.agrirouter.common.sleeper import Sleeper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

import pytest

from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.api.enums import CapabilityType
from agrirouter.api.messages import OutboxMessage
from agrirouter.service.parameter.messaging import FeedDeleteParameters
from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope
from agrirouter.service.messaging import MqttMessagingService
from agrirouter.service.messaging import SendMessageService, SendMessageParameters, FeedDeleteService
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.service.messaging.sequence_numbers import SequenceNumberService
from agrirouter.service.onboarding import OnboardResponse
from agrirouter.service.parameter.messaging import FeedDeleteParameters
from agrirouter.util.uuid_util import UUIDUtil
from tests.agrirouter.common.data_provider import DataProvider
from tests.agrirouter.common.sleeper import Sleeper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

import pytest

from agrirouter.generated.messaging.request.payload.endpoint.capabilities_pb2 import CapabilitySpecification
from agrirouter.generated.messaging.request.payload.endpoint.subscription_pb2 import Subscription
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.api.enums import CapabilityType, CapabilityDirectionType
from agrirouter.api.messages import OutboxMessage
from agrirouter.service.parameter.messaging import SubscriptionParameters, CapabilitiesParameters
from agrirouter.generated.messaging.request.payload.endpoint.capabilities_pb2 import CapabilitySpecification
from agrirouter.generated.messaging.request.payload.endpoint.subscription_pb2 import Subscription
from agrirouter.service.messaging import MqttMessagingService
from agrirouter.service.messaging import SubscriptionService, CapabilitiesService
from agrirouter.service.messaging.decoding import DecodingService
from agrirouter.service.messaging.sequence_numbers import SequenceNumberService
from agrirouter.service.parameter.messaging import SubscriptionParameters, CapabilitiesParameters
from agrirouter.util.uuid_util import UUIDUtil
from tests.agrirouter.common.sleeper import Sleeper
from tests.agrirouter.data.applications import CommunicationUnit
Expand Down

0 comments on commit 0263758

Please sign in to comment.