Skip to content

Commit

Permalink
Merge pull request #2218 from twobraids/none-ceph
Browse files Browse the repository at this point in the history
Fixes Bug 1040249 - Api usage error
  • Loading branch information
rhelmer committed Jul 17, 2014
2 parents e1cc06f + 23c05b0 commit 32447a5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions socorro/external/ceph/crashstorage.py
Expand Up @@ -331,10 +331,10 @@ def _fetch_from_boto_s3(self, crash_id, name_of_thing):
)
raise

key_as_string = "%s.%s" % (crash_id, name_of_thing)
key = bucket.get_key(key_as_string)
thing_as_string = key.get_contents_as_string()
return thing_as_string
key = "%s.%s" % (crash_id, name_of_thing)

storage_key = bucket.new_key(key)
return storage_key.get_contents_as_string()

#--------------------------------------------------------------------------
def _connect(self):
Expand Down
18 changes: 9 additions & 9 deletions socorro/unittest/external/ceph/test_crashstorage.py
Expand Up @@ -288,7 +288,7 @@ def test_get_raw_crash(self):
boto_s3_store = self.setup_mocked_s3_storage()
mocked_get_contents_as_string = (
boto_s3_store._connect_to_endpoint.return_value
.create_bucket.return_value.get_key.return_value
.create_bucket.return_value.new_key.return_value
.get_contents_as_string
)
mocked_get_contents_as_string.side_effect = [
Expand Down Expand Up @@ -331,7 +331,7 @@ def test_get_raw_dump(self):
boto_s3_store = self.setup_mocked_s3_storage()
mocked_get_contents_as_string = (
boto_s3_store._connect_to_endpoint.return_value
.create_bucket.return_value.get_key.return_value
.create_bucket.return_value.new_key.return_value
.get_contents_as_string
)
mocked_get_contents_as_string.side_effect = [
Expand Down Expand Up @@ -359,7 +359,7 @@ def test_get_raw_dump(self):
)

key_mock = boto_s3_store._mocked_connection.create_bucket \
.return_value.get_key.return_value
.return_value.new_key.return_value
self.assertEqual(key_mock.get_contents_as_string.call_count, 1)
key_mock.get_contents_as_string.assert_has_calls(
[
Expand All @@ -374,7 +374,7 @@ def test_get_raw_dumps(self):
boto_s3_store = self.setup_mocked_s3_storage()
mocked_get_contents_as_string = (
boto_s3_store._connect_to_endpoint.return_value
.create_bucket.return_value.get_key.return_value
.create_bucket.return_value.new_key.return_value
.get_contents_as_string
)
mocked_get_contents_as_string.side_effect = [
Expand Down Expand Up @@ -430,7 +430,7 @@ def test_get_raw_dumps_as_files(self):
)
mocked_get_contents_as_string = (
boto_s3_store._connect_to_endpoint.return_value
.create_bucket.return_value.get_key.return_value
.create_bucket.return_value.new_key.return_value
.get_contents_as_string
)
mocked_get_contents_as_string.side_effect = [
Expand Down Expand Up @@ -487,7 +487,7 @@ def test_get_unredacted_processed(self):
boto_s3_store = self.setup_mocked_s3_storage()
mocked_get_contents_as_string = (
boto_s3_store._connect_to_endpoint.return_value
.create_bucket.return_value.get_key.return_value
.create_bucket.return_value.new_key.return_value
.get_contents_as_string
)
mocked_get_contents_as_string.side_effect = [
Expand Down Expand Up @@ -515,7 +515,7 @@ def test_get_unredacted_processed(self):
)

key_mock = boto_s3_store._mocked_connection.create_bucket \
.return_value.get_key.return_value
.return_value.new_key.return_value
self.assertEqual(key_mock.get_contents_as_string.call_count, 1)
key_mock.get_contents_as_string.assert_has_calls([mock.call(), ])

Expand All @@ -528,7 +528,7 @@ def test_get_undredacted_processed_with_trouble(self):
)
mocked_bucket = boto_s3_store._connect_to_endpoint.return_value \
.create_bucket.return_value
mocked_key = mocked_bucket.get_key.return_value
mocked_key = mocked_bucket.new_key.return_value
mocked_key.get_contents_as_string \
.side_effect = [
self._fake_unredacted_processed_crash_as_string()
Expand Down Expand Up @@ -602,7 +602,7 @@ def test_not_found(self):
boto_s3_store = self.setup_mocked_s3_storage()
get_contents_as_string_mocked = (
boto_s3_store._mocked_connection.create_bucket
.return_value.get_key.return_value.get_contents_as_string
.return_value.new_key.return_value.get_contents_as_string
)
get_contents_as_string_mocked.side_effect = \
boto.exception.StorageResponseError(
Expand Down

0 comments on commit 32447a5

Please sign in to comment.