summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2019-08-01 21:07:43 -0700
committerTim Burke <tim.burke@gmail.com>2019-08-06 14:14:49 -0700
commit172aa9016977a3b03f07da0350c6aa9ade1e55a0 (patch)
tree2e5209243ad1ddc6f04f6b997d2578dbc9c4b730 /tests
parent7d50158440e1ce802cc395135333d2925de11864 (diff)
downloadpython-swiftclient-172aa9016977a3b03f07da0350c6aa9ade1e55a0.tar.gz
Fix up stable gate
This is a combination of three commits from master: --- Isolate docs requirements ...since modern sphinx won't install on py27. While we're at it, clean up some warnings and treat warnings as errors. Also, fix up how we parse test configs so we can run func tests. Related-Change: Id3c2ed87230c5918c18e2c01d086df8157f036b1 (cherry picked from commit 113eacf3b80f61d366b3e95b558b40f82ff728a4) --- Drag forward prettytable in lower-constraints Apparently version 0.7 got unpublished recently. (cherry picked from commit 5bd66947fc3d8987d4b24d5119a346031004229e) --- docs: Clean up formatting (cherry-picked from commit 7563d9cb5642c85a31708fd863e2737f9d6c9419) --- Change-Id: I3c6bca460ee5ff99195495a29e8b8bbf4ed804ff
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/test_swiftclient.py42
1 files changed, 28 insertions, 14 deletions
diff --git a/tests/functional/test_swiftclient.py b/tests/functional/test_swiftclient.py
index b4f275b..bae3044 100644
--- a/tests/functional/test_swiftclient.py
+++ b/tests/functional/test_swiftclient.py
@@ -46,11 +46,34 @@ class TestFunctional(unittest.TestCase):
config.read(config_file)
self.config = config
if config.has_section('func_test'):
- auth_host = config.get('func_test', 'auth_host')
- auth_port = config.getint('func_test', 'auth_port')
- auth_ssl = config.getboolean('func_test', 'auth_ssl')
- auth_prefix = config.get('func_test', 'auth_prefix')
- self.auth_version = config.get('func_test', 'auth_version')
+ if config.has_option('func_test', 'auth_uri'):
+ self.auth_url = config.get('func_test', 'auth_uri')
+ try:
+ self.auth_version = config.get('func_test', 'auth_version')
+ except configparser.NoOptionError:
+ last_piece = self.auth_url.rstrip('/').rsplit('/', 1)[1]
+ if last_piece.endswith('.0'):
+ last_piece = last_piece[:-2]
+ if last_piece in ('1', '2', '3'):
+ self.auth_version = last_piece
+ else:
+ raise
+ else:
+ auth_host = config.get('func_test', 'auth_host')
+ auth_port = config.getint('func_test', 'auth_port')
+ auth_ssl = config.getboolean('func_test', 'auth_ssl')
+ auth_prefix = config.get('func_test', 'auth_prefix')
+ self.auth_version = config.get('func_test', 'auth_version')
+ self.auth_url = ""
+ if auth_ssl:
+ self.auth_url += "https://"
+ else:
+ self.auth_url += "http://"
+ self.auth_url += "%s:%s%s" % (
+ auth_host, auth_port, auth_prefix)
+ if self.auth_version == "1":
+ self.auth_url += 'v1.0'
+
try:
self.account_username = config.get('func_test',
'account_username')
@@ -59,15 +82,6 @@ class TestFunctional(unittest.TestCase):
username = config.get('func_test', 'username')
self.account_username = "%s:%s" % (account, username)
self.password = config.get('func_test', 'password')
- self.auth_url = ""
- if auth_ssl:
- self.auth_url += "https://"
- else:
- self.auth_url += "http://"
- self.auth_url += "%s:%s%s" % (auth_host, auth_port, auth_prefix)
- if self.auth_version == "1":
- self.auth_url += 'v1.0'
-
else:
self.skip_tests = True