diff --git a/testinfra/test_etherpad.py b/testinfra/test_etherpad.py index 5f63d85f38..6c28dddef6 100644 --- a/testinfra/test_etherpad.py +++ b/testinfra/test_etherpad.py @@ -12,6 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. +import urllib.parse testinfra_hosts = ['etherpad99.opendev.org'] @@ -34,3 +35,26 @@ def test_etherpad_logs(host): mariadb_log_file = host.file('/var/log/containers/docker-mariadb.log') assert mariadb_log_file.exists assert mariadb_log_file.contains('mysqld: ready for connections') + +def test_etherpad_4_byte_utf8(host): + # The 🖖 utf8 character is a four byte character. This test ensures we + # can set that value in a pad and get it back out again. This test both + # general functionality as well as proper database setup for four byte + # utf8 chars + teststr = '🖖 Live long and prosper 🖖' + urlstr = urllib.parse.quote(teststr) + cmd = host.run('sudo docker-compose -f ' + '/etc/etherpad-docker/docker-compose.yaml ' + 'exec -T etherpad cat /opt/etherpad-lite/APIKEY.txt') + token = cmd.stdout.strip() + cmd = host.run('wget -qO- "http://localhost:9001/api/1/createPad?' + 'apikey=%s&padID=testing"' % token) + assert '"code":0' in cmd.stdout + assert '"message":"ok"' in cmd.stdout + cmd = host.run('wget -qO- "http://localhost:9001/api/1/setText?' + 'apikey=%s&padID=testing&text=%s"' % (token, urlstr)) + assert '"code":0' in cmd.stdout + assert '"message":"ok"' in cmd.stdout + cmd = host.run('wget -qO- "http://localhost:9001/api/1/getText?' + 'apikey=%s&padID=testing"' % token) + assert teststr in cmd.stdout