fix more tests

This commit is contained in:
Sebastian Pfahl 2025-07-14 21:40:53 +02:00
commit 1439274e15
2 changed files with 8 additions and 4 deletions

View file

@ -16,6 +16,8 @@ class MockCursor:
self.executed_queries = []
def execute(self, query):
if self.status == "ERROR":
raise Exception("Mocked execution error")
self.executed_queries.append(query)
def fetchone(self):
@ -44,7 +46,7 @@ def test_uses_replica_terminology(f_output, c_output, c_ret_type):
(None, None, "START GROUP_REPLICATION "),
("repl_user", None, "START GROUP_REPLICATION USER='repl_user'"),
(None, "repl_pass", "START GROUP_REPLICATION PASSWORD='repl_pass'"),
("repl_user", "repl_pass", "START GROUP_REPLICATION USER='repl_user', PASSWORD='repl_pass'"),
("repl_user", "repl_pass", "START GROUP_REPLICATION USER='repl_user',PASSWORD='repl_pass'"),
]
)
def test_start_group_replication(user, password, expected_query):
@ -58,9 +60,9 @@ def test_start_group_replication(user, password, expected_query):
chm = []
if user:
chm.append(" USER='%s'" % user)
chm.append("USER='%s'" % user)
if password:
chm.append(" PASSWORD='%s'" % password)
chm.append("PASSWORD='%s'" % password)
result = startgroupreplication(module, cursor, chm, False)

View file

@ -16,6 +16,8 @@ class MockCursor:
self.executed_queries = []
def execute(self, query):
if self.status == "ERROR":
raise Exception("Mocked execution error")
self.executed_queries.append(query)
def fetchone(self):
@ -48,7 +50,7 @@ def test_uses_replica_terminology(f_output, c_output, c_ret_type):
(None, None, "START GROUP_REPLICATION "),
("repl_user", None, "START GROUP_REPLICATION USER='repl_user'"),
(None, "repl_pass", "START GROUP_REPLICATION PASSWORD='repl_pass'"),
("repl_user", "repl_pass", "START GROUP_REPLICATION USER='repl_user', PASSWORD='repl_pass'"),
("repl_user", "repl_pass", "START GROUP_REPLICATION USER='repl_user',PASSWORD='repl_pass'"),
]
)
def test_start_group_replication(user, password, expected_query):