S3 should allow dashes in bucket names. Closes #5.
This commit is contained in:
parent
b03d48e6bc
commit
e55f26a07a
@ -1,10 +1,10 @@
|
|||||||
from .responses import bucket_response, key_response
|
from .responses import bucket_response, key_response
|
||||||
|
|
||||||
url_bases = [
|
url_bases = [
|
||||||
"https?://(?P<bucket_name>\w*)\.?s3.amazonaws.com"
|
"https?://(?P<bucket_name>[a-zA-Z0-9\-_]*)\.?s3.amazonaws.com"
|
||||||
]
|
]
|
||||||
|
|
||||||
url_paths = {
|
url_paths = {
|
||||||
'{0}/$': bucket_response,
|
'{0}/$': bucket_response,
|
||||||
'{0}/(?P<key_name>\w+)': key_response,
|
'{0}/(?P<key_name>[a-zA-Z0-9\-_]+)': key_response,
|
||||||
}
|
}
|
||||||
|
@ -6,5 +6,5 @@ url_bases = [
|
|||||||
|
|
||||||
url_paths = {
|
url_paths = {
|
||||||
'{0}/$': QueuesResponse().dispatch2,
|
'{0}/$': QueuesResponse().dispatch2,
|
||||||
'{0}/(?P<account_id>\d+)/(?P<queue_name>\w+)': QueueResponse().dispatch,
|
'{0}/(?P<account_id>\d+)/(?P<queue_name>[a-zA-Z0-9\-_]+)': QueueResponse().dispatch,
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ def test_flask_path_converting_simple():
|
|||||||
|
|
||||||
|
|
||||||
def test_flask_path_converting_regex():
|
def test_flask_path_converting_regex():
|
||||||
convert_regex_to_flask_path("/(?P<key_name>\w+)").should.equal('/<regex("\w+"):key_name>')
|
convert_regex_to_flask_path("/(?P<key_name>[a-zA-Z0-9\-_]+)").should.equal('/<regex("[a-zA-Z0-9\-_]+"):key_name>')
|
||||||
|
|
||||||
convert_regex_to_flask_path("(?P<account_id>\d+)/(?P<queue_name>.*)$").should.equal(
|
convert_regex_to_flask_path("(?P<account_id>\d+)/(?P<queue_name>.*)$").should.equal(
|
||||||
'<regex("\d+"):account_id>/<regex(".*"):queue_name>'
|
'<regex("\d+"):account_id>/<regex(".*"):queue_name>'
|
||||||
|
@ -107,6 +107,12 @@ def test_missing_bucket():
|
|||||||
conn.get_bucket.when.called_with('mybucket').should.throw(S3ResponseError)
|
conn.get_bucket.when.called_with('mybucket').should.throw(S3ResponseError)
|
||||||
|
|
||||||
|
|
||||||
|
@mock_s3
|
||||||
|
def test_bucket_with_dash():
|
||||||
|
conn = boto.connect_s3('the_key', 'the_secret')
|
||||||
|
conn.get_bucket.when.called_with('mybucket-test').should.throw(S3ResponseError)
|
||||||
|
|
||||||
|
|
||||||
@mock_s3
|
@mock_s3
|
||||||
def test_bucket_deletion():
|
def test_bucket_deletion():
|
||||||
conn = boto.connect_s3('the_key', 'the_secret')
|
conn = boto.connect_s3('the_key', 'the_secret')
|
||||||
|
Loading…
Reference in New Issue
Block a user