From 5f78657c526c86341a8279a2277d36c609e661b4 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Fri, 28 Aug 2015 13:03:09 -0700 Subject: [PATCH] test_boto cleanup --- tests/integration/test_boto.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/integration/test_boto.py b/tests/integration/test_boto.py index e4261a8..d00cf27 100644 --- a/tests/integration/test_boto.py +++ b/tests/integration/test_boto.py @@ -1,5 +1,6 @@ import pytest boto = pytest.importorskip("boto") + import boto import boto.iam from boto.s3.connection import S3Connection @@ -7,6 +8,7 @@ from boto.s3.key import Key from ConfigParser import DuplicateSectionError import vcr + def test_boto_stubs(tmpdir): with vcr.use_cassette(str(tmpdir.join('boto-stubs.yml'))): # Perform the imports within the patched context so that @@ -17,16 +19,18 @@ def test_boto_stubs(tmpdir): assert issubclass(CertValidatingHTTPSConnection, VCRCertValidatingHTTPSConnection) CertValidatingHTTPSConnection('hostname.does.not.matter') + def test_boto_without_vcr(): s3_conn = S3Connection() - s3_bucket = s3_conn.get_bucket('boto-demo-1394171994') # a bucket you can access + s3_bucket = s3_conn.get_bucket('boto-demo-1394171994') # a bucket you can access k = Key(s3_bucket) k.key = 'test.txt' k.set_contents_from_string('hello world i am a string') + def test_boto_medium_difficulty(tmpdir): s3_conn = S3Connection() - s3_bucket = s3_conn.get_bucket('boto-demo-1394171994') # a bucket you can access + s3_bucket = s3_conn.get_bucket('boto-demo-1394171994') # a bucket you can access with vcr.use_cassette(str(tmpdir.join('boto-medium.yml'))) as cass: k = Key(s3_bucket) k.key = 'test.txt' @@ -41,18 +45,19 @@ def test_boto_medium_difficulty(tmpdir): def test_boto_hardcore_mode(tmpdir): with vcr.use_cassette(str(tmpdir.join('boto-hardcore.yml'))) as cass: s3_conn = S3Connection() - s3_bucket = s3_conn.get_bucket('boto-demo-1394171994') # a bucket you can access + s3_bucket = s3_conn.get_bucket('boto-demo-1394171994') # a bucket you can access k = Key(s3_bucket) k.key = 'test.txt' k.set_contents_from_string('hello world i am a string') with vcr.use_cassette(str(tmpdir.join('boto-hardcore.yml'))) as cass: s3_conn = S3Connection() - s3_bucket = s3_conn.get_bucket('boto-demo-1394171994') # a bucket you can access + s3_bucket = s3_conn.get_bucket('boto-demo-1394171994') # a bucket you can access k = Key(s3_bucket) k.key = 'test.txt' k.set_contents_from_string('hello world i am a string') + def test_boto_iam(tmpdir): try: boto.config.add_section('Boto')