From f796f3f93b439634b1716a10cb41f029bf761495 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 9 Nov 2019 09:50:58 +0000 Subject: [PATCH] Test for non-ascii characters --- tests.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests.py b/tests.py index c457b536..d3aa6b73 100644 --- a/tests.py +++ b/tests.py @@ -390,7 +390,7 @@ def testPostMessageBetweenServers(): sendPost(__version__, \ sessionAlice,aliceDir,'alice', aliceDomain, alicePort, \ 'bob', bobDomain, bobPort, ccUrl, httpPrefix, \ - 'Why is a mouse when it spins? #sillyquestion', followersOnly, \ + 'Why is a mouse when it spins? यह एक परीक्षण है #sillyquestion', followersOnly, \ saveToFile, clientToServer,attachedImageFilename,mediaType, \ attachedImageDescription,useBlurhash, federationList, \ aliceSendThreads, alicePostLog, aliceCachedWebfingers, \ @@ -420,7 +420,16 @@ def testPostMessageBetweenServers(): assert testval==0 assert validInbox(bobDir,'bob',bobDomain) assert validInboxFilenames(bobDir,'bob',bobDomain,aliceDomain,alicePort) - + print('Check that message received from Alice contains the expected text') + for name in os.listdir(inboxPath): + filename=os.path.join(inboxPath, name) + assert os.path.isfile(filename) + with open(filename, 'r') as fp: + receivedJson=commentjson.load(fp) + pprint(receivedJson['object']['content']) + assert 'Why is a mouse when it spins?' in receivedJson['object']['content'] + assert 'यह एक परीक्षण है' in receivedJson['object']['content'] + print('\n\n*******************************************************') print("Bob likes Alice's post")