This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 7b1196b Fix kinesis test (#18337)
7b1196b is described below
commit 7b1196bc508cc93ac55ecf0bcf1da406f7809bd4
Author: Jed Cunningham <[email protected]>
AuthorDate: Sat Sep 18 02:41:19 2021 -0600
Fix kinesis test (#18337)
---
setup.py | 2 +-
tests/providers/amazon/aws/hooks/test_kinesis.py | 21 ++++++++++++---------
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/setup.py b/setup.py
index 5f4b104..bdf2bb2 100644
--- a/setup.py
+++ b/setup.py
@@ -511,7 +511,7 @@ devel = [
'jira',
'jsondiff',
'mongomock',
- 'moto~=2.2, >=2.2.1',
+ 'moto~=2.2, >=2.2.7',
'mypy==0.770',
'parameterized',
'paramiko',
diff --git a/tests/providers/amazon/aws/hooks/test_kinesis.py
b/tests/providers/amazon/aws/hooks/test_kinesis.py
index 5298432..d8f54e8 100644
--- a/tests/providers/amazon/aws/hooks/test_kinesis.py
+++ b/tests/providers/amazon/aws/hooks/test_kinesis.py
@@ -16,29 +16,32 @@
# specific language governing permissions and limitations
# under the License.
-import unittest
import uuid
+import boto3
+import pytest
+
from airflow.providers.amazon.aws.hooks.kinesis import AwsFirehoseHook
try:
- from moto import mock_kinesis
+ from moto import mock_firehose, mock_s3
except ImportError:
- mock_kinesis = None
+ mock_firehose = None
-class TestAwsFirehoseHook(unittest.TestCase):
- @unittest.skipIf(mock_kinesis is None, 'mock_kinesis package not present')
- @mock_kinesis
[email protected](mock_firehose is None, reason='moto package not present')
+class TestAwsFirehoseHook:
+ @mock_firehose
def test_get_conn_returns_a_boto3_connection(self):
hook = AwsFirehoseHook(
aws_conn_id='aws_default', delivery_stream="test_airflow",
region_name="us-east-1"
)
assert hook.get_conn() is not None
- @unittest.skipIf(mock_kinesis is None, 'mock_kinesis package not present')
- @mock_kinesis
+ @mock_firehose
+ @mock_s3
def test_insert_batch_records_kinesis_firehose(self):
+ boto3.client('s3').create_bucket(Bucket='kinesis-test')
hook = AwsFirehoseHook(
aws_conn_id='aws_default', delivery_stream="test_airflow",
region_name="us-east-1"
)
@@ -55,7 +58,7 @@ class TestAwsFirehoseHook(unittest.TestCase):
)
stream_arn = response['DeliveryStreamARN']
- assert stream_arn ==
"arn:aws:firehose:us-east-1:123456789012:deliverystream/test_airflow"
+ assert stream_arn ==
"arn:aws:firehose:us-east-1:123456789012:/delivery_stream/test_airflow"
records = [{"Data": str(uuid.uuid4())} for _ in range(100)]