Permalink
Browse files

fix bug in try/except, use correct request_path in hmac_body in test

  • Loading branch information...
1 parent f6e90e2 commit 4453524d6c5f6f7ff6e1da55d08352bb182ab833 @shawnps committed Aug 7, 2012
Showing with 4 additions and 5 deletions.
  1. +2 −1 libcloud/storage/drivers/cloudfiles.py
  2. +2 −4 libcloud/test/storage/test_cloudfiles.py
@@ -516,7 +516,8 @@ def ex_get_container_temp_url(self, container, method, timeout=60):
expires = int(time() + timeout)
path = self.connection.request_path + '/' + container.name
try:
- key = self.ex_get_meta_data()['temp_url_key'] and key != None
+ key = self.ex_get_meta_data()['temp_url_key']
+ key != None
except:
raise KeyError("You must first set the \
X-Account-Meta-Temp-URL-Key header on your \
@@ -633,12 +633,10 @@ def test_ex_get_container_temp_url(self, time):
container = Container(name='foo_bar_container', extra={},
driver=self)
hmac_body = "%s\n%s\n%s" % ('GET', 60,
- "v1/MossoCloudFS/foo_bar_container")
+ "/v1/MossoCloudFS/foo_bar_container")
sig = hmac.new("foo", hmac_body, sha1).hexdigest()
ret = self.driver.ex_get_container_temp_url(container, 'GET')
- temp_url = "https://storage101.ord1.clouddrive.com/v1/\
- MossoCloudFS/foo_bar_container?\
- temp_url_expires=60&temp_url_sig=%s" % sig
+ temp_url = "https://storage101.ord1.clouddrive.com/v1/MossoCloudFS/foo_bar_container?temp_url_expires=60&temp_url_sig=%s" % sig
self.assertEquals(ret, temp_url)

0 comments on commit 4453524

Please sign in to comment.