8000 tests: move test_mariadb_auth into test_connection · PyMySQL/PyMySQL@af21955 · GitHub
[go: up one dir, main page]

Skip to content
< 8000 div hidden="hidden" data-view-component="true" class="js-stale-session-flash stale-session-flash flash flash-warn flash-full"> Dismiss alert

Commit af21955

Browse files
committed
tests: move test_mariadb_auth into test_connection
1 parent e1ac86e commit af21955

File tree

4 files changed

+32
-47
lines changed

4 files changed

+32
-47
lines changed

.github/workflows/test.yaml

-8
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,12 @@ jobs:
1212
include:
1313
- db: "mariadb:10.2"
1414
py: "3.9"
15-
mariadb_auth: true
1615

1716
- db: "mariadb:10.3"
1817
py: "3.8"
19-
mariadb_auth: true
2018

2119
- db: "mariadb:10.5"
2220
py: "3.7"
23-
mariadb_auth: true
2421

2522
- db: "mysql:5.6"
2623
py: "3.6"
@@ -89,11 +86,6 @@ jobs:
8986
docker cp mysqld:/var/lib/mysql/client-cert.pem "${HOME}"
9087
pytest -v --cov --cov-config .coveragerc tests/test_auth.py;
9188
92-
- name: Run MariaDB auth test
93-
if: ${{ matrix.mariadb_auth }}
94-
run: |
95-
pytest -v --cov --cov-config .coveragerc tests/test_mariadb_auth.py
96-
9789
- name: Report coverage
9890
run: coveralls --service=github
9991
env:
-15
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,2 @@
1-
/*M!100401 CREATE USER nopass_ed25519 IDENTIFIED VIA ed25519 USING PASSWORD('') */;
2-
/*M!100401 CREATE USER user_ed25519 IDENTIFIED VIA ed25519 USING PASSWORD('pass_ed25519') */;
31
/*M!100122 INSTALL SONAME "auth_ed25519" */;
4-
--
5-
-- MariaDB [(none)]> select ed25519_password("");
6-
-- +---------------------------------------------+
7-
-- | ed25519_password("") |
8-
-- +---------------------------------------------+
9-
-- | 4LH+dBF+G5W2CKTyId8xR3SyDqZoQjUNUVNxx8aWbG4 |
10-
-- +---------------------------------------------+
11-
--
12-
13-
/*M!100401 CREATE USER nopass_ed25519 IDENTIFIED VIA ed25519 USING '4LH+dBF+G5W2CKTyId8xR3SyDqZoQjUNUVNxx8aWbG4' */;
14-
/*M!100401 CREATE USER user_ed25519 IDENTIFIED VIA ed25519 USING PASSWORD('pass_ed25519') */;
152
/*M!100122 CREATE FUNCTION ed25519_password RETURNS STRING SONAME "auth_ed25519.so" */;
16-
/*M!100203 EXECUTE IMMEDIATE CONCAT('CREATE USER IF NOT EXISTS nopass_ed25519 IDENTIFIED VIA ed25519 USING "', ed25519_password("") ,'";') */;
17-
/*M!100203 EXECUTE IMMEDIATE CONCAT('CREATE USER IF NOT EXISTS user_ed25519 IDENTIFIED VIA ed25519 USING "', ed25519_password("pass_ed25519") ,'";') */;

pymysql/tests/test_connection.py

+32
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class TestAuthentication(base.PyMySQLTestCase):
5353
pam_found = False
5454
mysql_old_password_found = False
5555
sha256_password_found = False
56+
ed25519_found = False
5657

5758
import os
5859

@@ -97,6 +98,8 @@ class TestAuthentication(base.PyMySQLTestCase):
9798
mysql_old_password_found = True
9899
elif r[0] == "sha256_password":
99100
sha256_password_found = True
101+
elif r[0] == "ed25519":
102+
ed25519_found = True
100103
# else:
101104
# print("plugin: %r" % r[0])
102105

@@ -412,6 +415,35 @@ def testAuthSHA256(self):
412415
with self.assertRaises(pymysql.err.OperationalError):
413416
pymysql.connect(user="pymysql_sha256", **db)
414417

418+
@pytest.mark.skipif(not ed25519_found, reason="no ed25519 authention plugin")
419+
def testAuthEd25519(self):
420+
db = self.db.copy()
421+
del db["password"]
422+
conn = self.connect()
423+
c = conn.cursor()
424+
c.execute("select ed25519_password(''), ed25519_password('ed25519_password')")
425+
for r in c:
426+
empty_pass = r[0].decode("ascii")
427+
non_empty_pass = r[1].decode("ascii")
428+
429+
with TempUser(
430+
c,
431+
"pymysql_ed25519",
432+
self.databases[0]["database"],
433+
"ed25519",
434+
empty_pass,
435+
) as u:
436+
pymysql.connect(user="pymysql_ed25519", password="", **db)
437+
438+
with TempUser(
439+
c,
440+
"pymysql_ed25519",
441+
self.databases[0]["database"],
442+
"ed25519",
443+
non_empty_pass,
444+
) as u:
445+
pymysql.connect(user="pymysql_ed25519", password="ed25519_password", **db)
446+
415447

416448
class TestConnection(base.PyMySQLTestCase):
417449
def test_utf8mb4(self):

tests/test_mariadb_auth.py

-24
This file was deleted.

0 commit comments

Comments
 (0)
0