diff options
author | Frederick Muriuki Muriithi | 2024-12-09 10:36:21 -0600 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-12-09 11:33:40 -0600 |
commit | 709991993e3aa9e9f8fbdd8453660b7a43547486 (patch) | |
tree | edfa9f90e7cba5cc10c0e91b22ce6396866fd0fb /tests/unit/test_mysqldb.py | |
parent | fd0b5916ad9d9b231a1322dcc1766fafdd6741a7 (diff) | |
download | gn-libs-709991993e3aa9e9f8fbdd8453660b7a43547486.tar.gz |
Parse a larger pool of possible boolean values
When a key is supposed to have a boolean value, parse the value from a
larger pool of both true and false values.
Diffstat (limited to 'tests/unit/test_mysqldb.py')
-rw-r--r-- | tests/unit/test_mysqldb.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/unit/test_mysqldb.py b/tests/unit/test_mysqldb.py index 5beaae3..b75f1e0 100644 --- a/tests/unit/test_mysqldb.py +++ b/tests/unit/test_mysqldb.py @@ -3,7 +3,7 @@ from unittest import mock import pytest -from gn_libs.mysqldb import parse_db_url, database_connection +from gn_libs.mysqldb import parse_db_url, database_connection, InvalidOptionValue @pytest.mark.unit_test @mock.patch("gn_libs.mysqldb.mdb") @@ -80,3 +80,14 @@ def test_parse_db_url_with_invalid_options(sql_uri, invalidopt): parse_db_url(sql_uri) assert exc_info.value.args[0] == f"Invalid database connection option ({invalidopt}) provided." + + +@pytest.mark.unit_test +@pytest.mark.parametrize( + "sql_uri", + (("mysql://auser:passwd@somehost:3307/thedb?use_unicode=fire"), + ("mysql://auser:passwd@somehost:3307/thedb?use_unicode=3"))) +def test_parse_db_url_with_invalid_options_values(sql_uri): + """Test parsing with invalid options' values.""" + with pytest.raises(InvalidOptionValue) as iov: + parse_db_url(sql_uri) |