Example #1
0
def get_s3_client(target, aws_access_key_id, aws_secret_access_key,
                  region_name):
    s3_uri = s3.parse_s3_uri(target)
    s3_client = boto3.client(
        's3',
        aws_access_key_id=aws_access_key_id,
        aws_secret_access_key=aws_secret_access_key,
        region_name=region_name,
    )
    return s3.S3SyncClient(s3_client, s3_uri.bucket, s3_uri.key)
Example #2
0
 def test_correct_output(self):
     actual_output = s3.parse_s3_uri("s3://fruit.bowl/apples/and/oranges/")
     assert actual_output.bucket == "fruit.bowl"
     assert actual_output.key == "apples/and/oranges/"
Example #3
0
 def test_no_path(self):
     assert s3.parse_s3_uri("s3://bucket") is None
Example #4
0
 def test_incorrect_format(self):
     assert s3.parse_s3_uri("nos3infront/some/path") is None
     assert s3.parse_s3_uri(":/232red+-32") is None
Example #5
0
 def test_empty(self):
     assert s3.parse_s3_uri("") is None
Example #6
0
File: test_s3.py Project: epayet/S4
 def test_correct_output(self):
     actual_output = s3.parse_s3_uri('s3://fruit.bowl/apples/and/oranges/')
     assert actual_output.bucket == 'fruit.bowl'
     assert actual_output.key == 'apples/and/oranges/'