Skip to content

Commit 50a9a46

Browse files
committed
Fix tests when using an external server with a non root user
Change-Id: I9375d915b626060ad2fe03b391d973efbd51e67f
1 parent be8cdfb commit 50a9a46

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

tests/qa/test_qa_mysqlx_collection_replace_remove_one.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ def test_collection_remove_one1(self):
258258
self.assertEqual(len(result), 0)
259259
self.schema.drop_collection("mycoll1")
260260

261+
@unittest.skipIf(
262+
tests.MYSQL_EXTERNAL_SERVER,
263+
"Test not available for external MySQL servers",
264+
)
261265
@tests.foreach_session()
262266
def test_collection_remove_one2(self):
263267
"""Test remove_one() when matching ID not found - succeeds and
@@ -337,6 +341,10 @@ def test_collection_replace3(self):
337341
self.assertIsNone(result3)
338342
self.schema.drop_collection("mycoll3")
339343

344+
@unittest.skipIf(
345+
tests.MYSQL_EXTERNAL_SERVER,
346+
"Test not available for external MySQL servers",
347+
)
340348
@unittest.skipUnless(tests.ARCH_64BIT, "Test available only for 64 bit platforms")
341349
@unittest.skipIf(os.name == "nt", "Test not available for Windows")
342350
@tests.foreach_session()

tests/qa/test_qa_wl7228.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ def test_option_file(self):
7373
config["use_pure"] = use_pure
7474
with mysql.connector.connect(**config) as cnx:
7575
with cnx.cursor() as _:
76-
self.assertEqual(cnx._user, "root")
77-
self.assertEqual(cnx._password, "")
76+
self.assertEqual(cnx._user, config["user"])
77+
self.assertEqual(cnx._password, config["password"])
7878
self.assertEqual(cnx._database, "cpy_data")
7979
self.assertEqual(cnx._use_unicode, True)
8080
self.assertEqual(cnx._autocommit, True)
@@ -97,8 +97,8 @@ def test_explicit_arg(self):
9797
for cls in self.all_cnx_classes:
9898
with cls(**config) as cnx:
9999
with cnx.cursor() as _:
100-
self.assertEqual(cnx._user, "root")
101-
self.assertEqual(cnx._password, "")
100+
self.assertEqual(cnx._user, config["user"])
101+
self.assertEqual(cnx._password, config["password"])
102102
self.assertEqual(cnx._database, "ex_data")
103103
self.assertEqual(cnx._buffered, False)
104104
self.assertEqual(cnx._force_ipv6, True)

0 commit comments

Comments
 (0)