Skip to content

Commit

Permalink
[AIRFLOW-4113] Unpin boto3 (#6884)
Browse files Browse the repository at this point in the history
(cherry picked from commit e0c6d86)
  • Loading branch information
kaxil authored and potiuk committed Jan 21, 2020
1 parent 985486a commit 06049fc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 33 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def write_version(filename=os.path.join(*["airflow", "git_version"])):
'atlasclient>=0.1.2',
]
aws = [
'boto3>=1.7.0, <1.8.0',
'boto3~=1.10',
]
azure_blob_storage = [
'azure-storage>=0.34.0',
Expand Down Expand Up @@ -378,7 +378,7 @@ def write_version(filename=os.path.join(*["airflow", "git_version"])):
'jira',
'mock;python_version<"3.3"',
'mongomock',
'moto==1.3.5',
'moto>=1.3.14,<2.0.0',
'parameterized',
'paramiko',
'pre-commit',
Expand Down
2 changes: 1 addition & 1 deletion tests/contrib/hooks/test_aws_dynamodb_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_insert_batch_items_dynamodb_table(self):
],
AttributeDefinitions=[
{
'AttributeName': 'name',
'AttributeName': 'id',
'AttributeType': 'S'
}
],
Expand Down
36 changes: 8 additions & 28 deletions tests/contrib/hooks/test_aws_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_get_resource_type_returns_a_boto3_resource_of_the_requested_type(self):
],
AttributeDefinitions=[
{
'AttributeName': 'name',
'AttributeName': 'id',
'AttributeType': 'S'
}
],
Expand Down Expand Up @@ -95,7 +95,7 @@ def test_get_session_returns_a_boto3_session(self):
],
AttributeDefinitions=[
{
'AttributeName': 'name',
'AttributeName': 'id',
'AttributeType': 'S'
}
],
Expand Down Expand Up @@ -192,33 +192,13 @@ def test_get_credentials_from_role_arn(self, mock_get_connection):
mock_get_connection.return_value = mock_connection
hook = AwsHook()
credentials_from_hook = hook.get_credentials()
self.assertEqual(credentials_from_hook.access_key, 'AKIAIOSFODNN7EXAMPLE')
self.assertEqual(credentials_from_hook.secret_key,
'aJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY')
self.assertEqual(credentials_from_hook.token,
'BQoEXAMPLEH4aoAH0gNCAPyJxz4BlCFFxWNE1OPTgk5TthT+FvwqnKwRcOIfrRh'
'3c/LTo6UDdyJwOOvEVPvLXCrrrUtdnniCEXAMPLE/IvU1dYUg2RVAJBanLiHb4I'
'gRmpRV3zrkuWJOgQs8IZZaIv2BXIa2R4OlgkBN9bkUDNCJiBeb/AXlzBBko7b15'
'fjrBs2+cTQtpZ3CYWFXG8C5zqx37wnOE49mRl/+OtkIKGO7fAE')
self.assertIn("ASIA", credentials_from_hook.access_key)

@unittest.skipIf(mock_sts is None, 'mock_sts package not present')
@mock.patch.object(AwsHook, 'get_connection')
@mock_sts
def test_get_credentials_from_role_arn_with_external_id(self, mock_get_connection):
mock_connection = Connection(
extra='{"role_arn":"arn:aws:iam::123456:role/role_arn",'
' "external_id":"external_id"}')
mock_get_connection.return_value = mock_connection
hook = AwsHook()
credentials_from_hook = hook.get_credentials()
self.assertEqual(credentials_from_hook.access_key, 'AKIAIOSFODNN7EXAMPLE')
self.assertEqual(credentials_from_hook.secret_key,
'aJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY')
self.assertEqual(credentials_from_hook.token,
'BQoEXAMPLEH4aoAH0gNCAPyJxz4BlCFFxWNE1OPTgk5TthT+FvwqnKwRcOIfrRh'
'3c/LTo6UDdyJwOOvEVPvLXCrrrUtdnniCEXAMPLE/IvU1dYUg2RVAJBanLiHb4I'
'gRmpRV3zrkuWJOgQs8IZZaIv2BXIa2R4OlgkBN9bkUDNCJiBeb/AXlzBBko7b15'
'fjrBs2+cTQtpZ3CYWFXG8C5zqx37wnOE49mRl/+OtkIKGO7fAE')
# We assert the length instead of actual values as the values are random:
# Details: https://github.com/spulec/moto/commit/ab0d23a0ba2506e6338ae20b3fde70da049f7b03
self.assertEqual(20, len(credentials_from_hook.access_key))
self.assertEqual(40, len(credentials_from_hook.secret_key))
self.assertEqual(356, len(credentials_from_hook.token))

@unittest.skipIf(mock_iam is None, 'mock_iam package not present')
@mock_iam
Expand Down
4 changes: 2 additions & 2 deletions tests/contrib/operators/test_hive_to_dynamodb_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_get_records_with_schema(self, get_results_mock):
],
AttributeDefinitions=[
{
'AttributeName': 'name',
'AttributeName': 'id',
'AttributeType': 'S'
}
],
Expand Down Expand Up @@ -116,7 +116,7 @@ def test_pre_process_records_with_schema(self, get_results_mock):
],
AttributeDefinitions=[
{
'AttributeName': 'name',
'AttributeName': 'id',
'AttributeType': 'S'
}
],
Expand Down

0 comments on commit 06049fc

Please sign in to comment.