-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: url quote passwords #549
fix: url quote passwords #549
Conversation
looks good, running these tests on my machine first and fixing some stuff up with static ports had this other thought: do we care to simulate the craziest input possible, or is it better to replicate exactly the situation you saw, which is the auth denied error? not sure, maybe you have considered this though e.g. diff --git a/modules/mysql/tests/test_mysql.py b/modules/mysql/tests/test_mysql.py
index 62deac5..8ab347f 100644
--- a/modules/mysql/tests/test_mysql.py
+++ b/modules/mysql/tests/test_mysql.py
@@ -58,11 +58,21 @@ def test_docker_env_variables():
# - mongodb
def test_quoted_password():
user = "root"
- password = "p@$%25+0&%rd :/!=?"
- quoted_password = "p%40%24%2525+0%26%25rd %3A%2F%21%3D%3F"
+ password = "p$%25+0&%rd"
+ quoted_password = "p%24%2525+0%26%25rd"
driver = "pymysql" maybe the answer is to parametrize, or i am just overthinking it |
opened #550 because debugging mssql is very not fun on a mac at the moment. |
alright hopefully this doesn't break anybody |
🤖 I have created a release *beep* *boop* --- ## [4.4.1](testcontainers-v4.4.0...testcontainers-v4.4.1) (2024-05-14) ### Bug Fixes * Add memcached container ([#322](#322)) ([690b9b4](690b9b4)) * Add selenium video support [#6](#6) ([#364](#364)) ([3c8006c](3c8006c)) * **core:** add empty _configure to DockerContainer ([#556](#556)) ([08916c8](08916c8)) * **core:** remove version from compose tests ([#571](#571)) ([38946d4](38946d4)) * **keycloak:** add realm imports ([#565](#565)) ([f761b98](f761b98)) * **mysql:** Add seed support in MySQL ([#552](#552)) ([396079a](396079a)) * url quote passwords ([#549](#549)) ([6c5d227](6c5d227)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Changes
Updated DbContainer to fix #547 by using
urllib.parse.quote
. I referenced sqlalchemy's implementation, but have not imported the library.I have chosen to make this behaviour occur at all times (can't opt in / out), as it is common, if not the standard for these urls.
Tests
Since DbContainer can't be tested on its own, I put the tests across various database containers. I have pasted the below as comment in the test files for the listed modules:
Note the discussion recommended me to test with oracle, but I was unable to spin the container up locally (even with colima), so opted to replace it with mongodb.
Is there a template for PRs for the core library? I am unable to find one so have opted the above format. Please let me know if I have missed anything in this PR. Thanks!