Skip to content

Commit

Permalink
use ~/.s3cfg in run-tests too
Browse files Browse the repository at this point in the history
  • Loading branch information
mdomsch committed Feb 21, 2014
1 parent 44e3589 commit e14a751
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions run-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from subprocess import Popen, PIPE, STDOUT
import locale
import getpass
import S3.Exceptions
import S3.Config

count_pass = 0
count_fail = 0
Expand All @@ -31,6 +33,14 @@
print "Unknown platform: %s" % os.name
sys.exit(1)

config_file = None
if os.getenv("HOME"):
config_file = os.path.join(os.getenv("HOME"), ".s3cfg")
elif os.name == "nt" and os.getenv("USERPROFILE"):
config_file = os.path.join(os.getenv("USERPROFILE").decode('mbcs'), "Application Data", "s3cmd.ini")

cfg = S3.Config.Config(config_file)

## Unpack testsuite/ directory
if not os.path.isdir('testsuite') and os.path.isfile('testsuite.tar.gz'):
os.system("tar -xz -f testsuite.tar.gz")
Expand Down Expand Up @@ -355,7 +365,7 @@ def pbucket(tail):

## ====== Retrieve from URL
if have_wget:
test("Retrieve from URL", ['wget', '-O', 'testsuite-out/logo.png', 'http://%s.s3.amazonaws.com/xyz/etc/logo.png' % bucket(1)],
test("Retrieve from URL", ['wget', '-O', 'testsuite-out/logo.png', 'http://%s.%s/xyz/etc/logo.png' % (bucket(1), cfg.host_base)],
must_find_re = [ 'logo.png.*saved \[22059/22059\]' ])


Expand All @@ -366,7 +376,7 @@ def pbucket(tail):

## ====== Verify Private ACL
if have_wget:
test("Verify Private ACL", ['wget', '-O', 'testsuite-out/logo.png', 'http://%s.s3.amazonaws.com/xyz/etc/logo.png' % bucket(1)],
test("Verify Private ACL", ['wget', '-O', 'testsuite-out/logo.png', 'http://%s.%s/xyz/etc/logo.png' % (bucket(1), cfg.host_base)],
retcode = 8,
must_find_re = [ 'ERROR 403: Forbidden' ])

Expand All @@ -378,7 +388,7 @@ def pbucket(tail):

## ====== Verify Public ACL
if have_wget:
test("Verify Public ACL", ['wget', '-O', 'testsuite-out/logo.png', 'http://%s.s3.amazonaws.com/xyz/etc/logo.png' % bucket(1)],
test("Verify Public ACL", ['wget', '-O', 'testsuite-out/logo.png', 'http://%s.%s/xyz/etc/logo.png' % (bucket(1), cfg.host_base)],
must_find_re = [ 'logo.png.*saved \[22059/22059\]' ])


Expand Down Expand Up @@ -461,7 +471,7 @@ def pbucket(tail):
test_s3cmd("Verify ACL and MIME type", ['info', '%s/copy/etc2/Logo.PNG' % pbucket(2) ],
must_find_re = [ "MIME type:.*image/png",
"ACL:.*\*anon\*: READ",
"URL:.*http://%s.s3.amazonaws.com/copy/etc2/Logo.PNG" % bucket(2) ])
"URL:.*http://%s.%s/copy/etc2/Logo.PNG" % (bucket(2), cfg.host_base) ])

## ====== Rename within S3
test_s3cmd("Rename within S3", ['mv', '%s/copy/etc2/Logo.PNG' % pbucket(2), '%s/copy/etc/logo.png' % pbucket(2)],
Expand Down

0 comments on commit e14a751

Please sign in to comment.