From 6bb67567f9d5d9ccb0adad8b4375ffe17e197cb3 Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Sat, 8 Mar 2014 19:24:11 -1000 Subject: [PATCH] add tests for boto --- tests/integration/test_boto.py | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/integration/test_boto.py diff --git a/tests/integration/test_boto.py b/tests/integration/test_boto.py new file mode 100644 index 0000000..567a468 --- /dev/null +++ b/tests/integration/test_boto.py @@ -0,0 +1,41 @@ +import pytest +boto = pytest.importorskip("boto") +from boto.s3.connection import S3Connection +from boto.s3.key import Key +import vcr + +def test_boto_without_vcr(): + s3_conn = S3Connection() + 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 + with vcr.use_cassette(str(tmpdir.join('boto-medium.yml'))) as cass: + 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-medium.yml'))) as cass: + k = Key(s3_bucket) + k.key = 'test.txt' + k.set_contents_from_string('hello world i am a string') + + +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 + 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 + k = Key(s3_bucket) + k.key = 'test.txt' + k.set_contents_from_string('hello world i am a string')