def test_get_last_server_gtid(self): # Get last GTID from a given GTID set (for all UUIDs and non-existing). gtid_set = ('cfb4dd08-588e-11e4-89aa-606720440b68:7,' 'D4F8EB6E-588e-11E4-89AA-606720440b68:1-4:6:8:10-11,' 'da1f90b1-588e-11e4-89aa-606720440b68:5-8') expected_result = ['cfb4dd08-588e-11e4-89aa-606720440b68:7', 'd4f8eb6e-588e-11e4-89aa-606720440b68:11', 'da1f90b1-588e-11e4-89aa-606720440b68:8', None] uuids = ['cfb4dd08-588e-11e4-89aa-606720440b68', 'd4f8eb6e-588e-11e4-89aa-606720440b68', 'da1f90b1-588e-11e4-89aa-606720440b68', 'aaaaaaaa-588e-11e4-89aa-606720440b68'] for i, uuid in enumerate(uuids): result = get_last_server_gtid(gtid_set, uuid) self.assertEqual(expected_result[i], result)