File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 4
4
import json
5
5
import string
6
6
7
+ from kafka .errors import IllegalArgumentError
7
8
from kafka .vendor .six .moves import urllib
8
9
9
10
@@ -67,7 +68,7 @@ def region(self):
67
68
return region
68
69
69
70
# Otherwise give up
70
- raise Exception ('Could not determine region from broker host(s) or aws configuration' )
71
+ raise IllegalArgumentError ('Could not determine region from broker host(s) or aws configuration' )
71
72
72
73
@property
73
74
def _credential (self ):
Original file line number Diff line number Diff line change 5
5
import pytest
6
6
from unittest import TestCase
7
7
8
+ from kafka .errors import IllegalArgumentError
8
9
from kafka .msk import AwsMskIamClient
9
10
10
11
try :
@@ -81,13 +82,13 @@ def test_aws_msk_iam_no_region(boto_session):
81
82
# No region from config
82
83
boto_session .get_config_variable = mock .MagicMock (return_value = None )
83
84
84
- with TestCase ().assertRaises (Exception ) as e :
85
+ with TestCase ().assertRaises (IllegalArgumentError ) as e :
85
86
# No region from hostname
86
87
msk_client = AwsMskIamClient (
87
88
host = 'localhost' ,
88
89
boto_session = boto_session ,
89
90
)
90
- assert 'Could not determine region from broker host(s) or aws configuration' == str (e .exception )
91
+ assert 'IllegalArgumentError: Could not determine region from broker host(s) or aws configuration' == str (e .exception )
91
92
92
93
93
94
@pytest .mark .parametrize ('session_token' , [(None ), ('the_token' )])
You can’t perform that action at this time.
0 commit comments