glance/glance/tests/unit
Ian Wienand f601cfccf1 Support RFC1738 quoted chars in passwords
In the bug, a user tried setting a devstack password with a "@" in it.

As it turns out, sqlalchmey turns the connection-string into a
sqlalchemy.engine.url.URL object [1] which returns a RFC1738 quoted
string.

However, alembic's set_main_option [2] uses python
string-interpolation which interprets '%' characters.  This means you
end up with an interpolation traceback when using any quoted character
(':@/') in a user/password (more likely password).

Avoid this by ensuring the URL is safe for python interpolation in
set_main_option by replacing '%' -> '%%'.

I convinced myself this is safe because sqlalchemy correctly parses
the quoted and unquoted versions just the same

---
 >>> str(sqlalchemy.engine.url.make_url('mysql+pymysql://foo:crazy:@/pw@/moo'))
 'mysql+pymysql://foo:crazy%3A%40%2Fpw@/moo'
 >>> str(sqlalchemy.engine.url.make_url('mysql+pymysql://foo:crazy%3A%40%2Fpw@/moo'))
 'mysql+pymysql://foo:crazy%3A%40%2Fpw@/moo'
---

A test is added

[1] https://github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/engine/url.py
[2] http://alembic.zzzcomputing.com/en/latest/api/config.html#alembic.config.Config.set_main_option

Change-Id: I3ef7e3e539e35ce040573f2044ab6eb3c990200a
Closes-Bug: #1695299
2018-08-13 14:44:32 +10:00
..
api Introduce ''mock_object'' method to base test class 2018-08-09 12:40:12 -04:00
async Use glance.context.RequestContext in tests 2018-07-16 19:11:50 +00:00
common Introduce ''mock_object'' method to base test class 2018-08-09 12:40:12 -04:00
image_cache Handle file delete races in image cache 2017-07-10 11:37:55 -05:00
v2 Introduce ''mock_object'' method to base test class 2018-08-09 12:40:12 -04:00
__init__.py Empty files shouldn't contain copyright nor license 2013-12-24 22:39:05 -06:00
base.py Introduce ''mock_object'' method to base test class 2018-08-09 12:40:12 -04:00
fake_rados.py Fixes rbd _delete_image snapshot with missing image 2013-10-07 23:15:49 +01:00
fixtures.py Add fixture to limit unit test log output 2018-04-09 21:17:54 +00:00
test_auth.py Introduce ''mock_object'' method to base test class 2018-08-09 12:40:12 -04:00
test_cache_middleware.py Remove Images API v1 entry points 2018-07-13 10:21:49 +01:00
test_cached_images.py Improved coverage for glance.api.* 2014-06-15 17:44:09 +00:00
test_context.py Use new oslo.context arg names 2017-11-27 10:20:10 -06:00
test_context_middleware.py Support Unicode request_id on Python 3 2015-11-27 15:44:54 +01:00
test_data_migration_framework.py Modify glance manage db sync to use EMC 2018-02-05 17:00:57 +05:30
test_db.py Pending-delete rollback ability 2018-04-19 11:03:59 +08:00
test_db_metadef.py Don't use slashes for long lines - use parentheses instead 2015-08-16 07:21:13 +00:00
test_domain.py Glare-ectomy 2017-03-01 21:46:52 +00:00
test_domain_proxy.py Fix for Image members not generating notifications 2016-01-25 04:50:58 -08:00
test_glance_manage.py Provide user friendly message for FK failure 2017-04-05 15:56:32 +05:30
test_glance_replicator.py Add fixture to only emit DeprecationWarning once 2017-12-12 15:49:04 +00:00
test_image_cache.py Introduce ''mock_object'' method to base test class 2018-08-09 12:40:12 -04:00
test_manage.py Support RFC1738 quoted chars in passwords 2018-08-13 14:44:32 +10:00
test_misc.py Port v1.test_registry_api to Python 3 2015-10-22 22:53:05 +02:00
test_notifier.py Add multi-store support 2018-08-01 08:53:47 +00:00
test_policy.py Introduce ''mock_object'' method to base test class 2018-08-09 12:40:12 -04:00
test_quota.py Introduce ''mock_object'' method to base test class 2018-08-09 12:40:12 -04:00
test_schema.py Fix assertEqual arguments order 2014-09-19 00:25:18 +08:00
test_scrubber.py Pending-delete rollback ability 2018-04-19 11:03:59 +08:00
test_store_image.py Introduce ''mock_object'' method to base test class 2018-08-09 12:40:12 -04:00
test_store_location.py Introduce ''mock_object'' method to base test class 2018-08-09 12:40:12 -04:00
test_versions.py Add API version 2.8 2018-08-07 16:39:06 +01:00
utils.py Multihash implementation for Glance 2018-07-31 21:28:38 -04:00