From 757c45c659e67b3aca4ebb831da4d02f1431815f Mon Sep 17 00:00:00 2001 From: Steve Pulec Date: Mon, 25 Feb 2013 23:21:49 -0500 Subject: [PATCH] replace pdbs with NotImplemented --- moto/s3/responses.py | 4 ++-- requirements.txt | 1 + tests/test_s3/test_s3.py | 11 +++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/moto/s3/responses.py b/moto/s3/responses.py index f830701a5..c895b8cda 100644 --- a/moto/s3/responses.py +++ b/moto/s3/responses.py @@ -44,7 +44,7 @@ def bucket_response(uri, body, headers): template = Template(S3_DELETE_BUCKET_WITH_ITEMS_ERROR) return template.render(bucket=removed_bucket), dict(status=409) else: - import pdb;pdb.set_trace() + raise NotImplementedError("Method {} has not been impelemented in the S3 backend yet".format(method)) def key_response(uri_info, body, headers): @@ -85,7 +85,7 @@ def key_response(uri_info, body, headers): template = Template(S3_DELETE_OBJECT_SUCCESS) return template.render(bucket=removed_key), dict(status=204) else: - import pdb;pdb.set_trace() + raise NotImplementedError("Method {} has not been impelemented in the S3 backend yet".format(method)) S3_ALL_BUCKETS = """ diff --git a/requirements.txt b/requirements.txt index 5eb4d1fe8..b171809e0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,4 +5,5 @@ freezegun Jinja2 mock nose +requests sure \ No newline at end of file diff --git a/tests/test_s3/test_s3.py b/tests/test_s3/test_s3.py index 16189aa33..a5b54ad1f 100644 --- a/tests/test_s3/test_s3.py +++ b/tests/test_s3/test_s3.py @@ -1,6 +1,7 @@ import boto from boto.exception import S3ResponseError from boto.s3.key import Key +import requests import sure @@ -90,3 +91,13 @@ def test_get_all_buckets(): buckets = conn.get_all_buckets() buckets.should.have.length_of(2) + + +@mock_s3 +def test_bucket_method_not_implemented(): + requests.post.when.called_with("https://foobar.s3.amazonaws.com/").should.throw(NotImplementedError) + + +@mock_s3 +def test_key_method_not_implemented(): + requests.post.when.called_with("https://foobar.s3.amazonaws.com/foo").should.throw(NotImplementedError)