diff --git a/tests/unit/plugins/module_utils/test_mariadb_replication.py b/tests/unit/plugins/module_utils/test_mariadb_replication.py index 3599ad0..4082ad2 100644 --- a/tests/unit/plugins/module_utils/test_mariadb_replication.py +++ b/tests/unit/plugins/module_utils/test_mariadb_replication.py @@ -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) diff --git a/tests/unit/plugins/module_utils/test_mysql_replication.py b/tests/unit/plugins/module_utils/test_mysql_replication.py index 8768b1e..a4f906c 100644 --- a/tests/unit/plugins/module_utils/test_mysql_replication.py +++ b/tests/unit/plugins/module_utils/test_mysql_replication.py @@ -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):