[PATCH] D68922: [LNT] Python 3 support: read machine deletion page as text
Thomas Preud'homme via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 12 15:55:38 PDT 2019
thopre created this revision.
thopre added reviewers: cmatthews, hubert.reinterpretcast, kristof.beyls.
thopre added a parent revision: D68921: [LNT] Python 3 support: fix server/ui/statsTester.py test discovery.
Test server/ui/test_api_modify.py deletes some machines via the REST
interface and tests that the content of page displayed upon that action.
Since that content is made of text, it is compared against a string.
However by default Flask returns the content as binary data which leads
to an invalid comparison of str against byte. This commit fixes it by
requesting the content as a string from Flask using the as_text
parameter from get_data() property getter.
https://reviews.llvm.org/D68922
Files:
tests/server/ui/test_api_modify.py
Index: tests/server/ui/test_api_modify.py
===================================================================
--- tests/server/ui/test_api_modify.py
+++ tests/server/ui/test_api_modify.py
@@ -148,7 +148,7 @@
resp = client.delete('api/db_default/v4/nts/machines/2',
headers={'AuthToken': 'test_token'})
self.assertEqual(resp.status_code, 200)
- self.assertEqual(resp.get_data(),
+ self.assertEqual(resp.get_data(as_text=True),
'''Deleting runs 3 5 6 7 8 9 (6/6)
Deleted machine machine2:2
''')
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68922.224763.patch
Type: text/x-patch
Size: 583 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191012/b8e8c7e5/attachment.bin>
More information about the llvm-commits
mailing list