Skip to content

Commit 354e4a9

Browse files
authored
hotfix bugaround undefined workspace id for Quix API clas (#329)
Bug was result of removing Exceptions from the class to the general `exception.py` file
1 parent 3af4838 commit 354e4a9

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

quixstreams/platforms/quix/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from quixstreams.exceptions import QuixException
1212
from quixstreams.models.topics import Topic
1313
from .api import QuixPortalApiService
14+
from .exceptions import UndefinedQuixWorkspaceId
1415

1516
logger = logging.getLogger(__name__)
1617

@@ -122,7 +123,7 @@ def __init__(
122123

123124
try:
124125
self._workspace_id = workspace_id or self.api.default_workspace_id
125-
except self.api.UndefinedQuixWorkspaceId:
126+
except UndefinedQuixWorkspaceId:
126127
self._workspace_id = None
127128
logger.warning(
128129
"No workspace ID was provided directly or found via environment; "

tests/test_quixstreams/test_platforms/test_quix/test_config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@
77
import pytest
88
from requests import HTTPError, Response
99

10+
from quixstreams.platforms.quix.api import QuixPortalApiService
1011
from quixstreams.platforms.quix.config import (
1112
QUIX_CONNECTIONS_MAX_IDLE_MS,
1213
QUIX_METADATA_MAX_AGE_MS,
1314
)
1415

1516

1617
class TestQuixKafkaConfigsBuilder:
18+
def test_no_workspace_id_warning(self, quix_kafka_config_factory, caplog):
19+
quix_kafka_config_factory(api_class=QuixPortalApiService(auth_token="12345"))
20+
assert "No workspace ID was provided" in caplog.text
21+
1722
def test_search_for_workspace_id(self, quix_kafka_config_factory):
1823
api_data_stub = {"workspaceId": "myworkspace12345", "name": "my workspace"}
1924
cfg_factory = quix_kafka_config_factory(

0 commit comments

Comments
 (0)