@@ -45,10 +45,10 @@ def test_uses_replica_terminology(f_output, c_output, c_ret_type):
4545@pytest .mark .parametrize (
4646 'user,password,expected_query' ,
4747 [
48- (None , None , "START GROUP_REPLICATION" ),
48+ (None , None , "START GROUP_REPLICATION " ),
4949 ("repl_user" , None , "START GROUP_REPLICATION USER='repl_user'" ),
50- (None , "repl_pass" , "START GROUP_REPLICATION" ),
51- ("repl_user" , "repl_pass" , "START GROUP_REPLICATION USER='repl_user' PASSWORD='repl_pass'" ),
50+ (None , "repl_pass" , "START GROUP_REPLICATION PASSWORD='repl_pass' " ),
51+ ("repl_user" , "repl_pass" , "START GROUP_REPLICATION USER='repl_user', PASSWORD='repl_pass'" ),
5252 ]
5353)
5454def test_start_group_replication (user , password , expected_query ):
@@ -62,15 +62,14 @@ def test_start_group_replication(user, password, expected_query):
6262
6363 chm = []
6464 if user :
65- chm .append (" USER='%s'" % user )
65+ chm .append ("USER='%s'" % user )
6666 if password :
67- chm .append (" PASSWORD='%s'" % password )
67+ chm .append ("PASSWORD='%s'" % password )
6868
6969 result = startgroupreplication (module , cursor , chm , False )
7070
7171 assert result is True
7272 assert cursor .executed_queries [0 ] == expected_query
73- assert cursor .executed_queries [1 ] == "SHOW STATUS LIKE 'group_replication_status';"
7473
7574
7675def test_stop_group_replication ():
@@ -86,22 +85,17 @@ def test_stop_group_replication():
8685
8786 assert result is True
8887 assert cursor .executed_queries [0 ] == "STOP GROUP_REPLICATION"
89- assert cursor .executed_queries [1 ] == "SHOW STATUS LIKE 'group_replication_status';"
9088
9189
9290def test_start_group_replication_fail ():
9391 """Test startgroupreplication function with failure."""
9492 from ansible_collections .community .mysql .plugins .modules .mysql_replication import startgroupreplication
95- import pymysql
9693
9794 cursor = MockCursor (status = "ERROR" )
9895 module = type ('obj' , (object ,), {
9996 'fail_json' : lambda msg : None ,
10097 })
10198
102- # Mock the Warning exception
103- pymysql .Warning = Exception
104-
10599 result = startgroupreplication (module , cursor , [], True )
106100
107101 assert result is False
@@ -110,16 +104,12 @@ def test_start_group_replication_fail():
110104def test_stop_group_replication_fail ():
111105 """Test stopgroupreplication function with failure."""
112106 from ansible_collections .community .mysql .plugins .modules .mysql_replication import stopgroupreplication
113- import pymysql
114107
115108 cursor = MockCursor (status = "ERROR" )
116109 module = type ('obj' , (object ,), {
117110 'fail_json' : lambda msg : None ,
118111 })
119112
120- # Mock the Warning exception
121- pymysql .Warning = Exception
122-
123113 result = stopgroupreplication (module , cursor , True )
124114
125115 assert result is False
0 commit comments