Mercurial > p > roundup > code
diff test/test_liveserver.py @ 7557:7b481ec7f169
test: fix test_rest_login_RateLimit CI has different char numbers
It looks like the json returned has different spacing when pretty
printed.
Under CI, I get 157 chars under python2 and 161 under python3. On
local development, I get 167. The data is the same in all three
environments. Change test to load json data structure and compare
against a dict that matches the returned data.
Also remove encoding type, not critical to test.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Wed, 19 Jul 2023 21:12:56 -0400 |
| parents | 273c8c2b5042 |
| children | 0abc225864d1 |
line wrap: on
line diff
--- a/test/test_liveserver.py Wed Jul 19 20:37:45 2023 -0400 +++ b/test/test_liveserver.py Wed Jul 19 21:12:56 2023 -0400 @@ -1507,10 +1507,39 @@ 'Allow'), 'Access-Control-Allow-Origin': 'http://localhost:9001', 'Access-Control-Allow-Credentials': 'true', - 'Allow': 'OPTIONS, GET, POST, PUT, DELETE, PATCH', - 'Content-Length': '167', - 'Content-Encoding': 'gzip'} + 'Allow': 'OPTIONS, GET, POST, PUT, DELETE, PATCH' + } for header in headers_expected.keys(): self.assertEqual(f.headers[header], headers_expected[header]) + + expected_data = { + "status": { + "link": "http://localhost:9001/rest/data/status" + }, + "keyword": { + "link": "http://localhost:9001/rest/data/keyword" + }, + "priority": { + "link": "http://localhost:9001/rest/data/priority" + }, + "user": { + "link": "http://localhost:9001/rest/data/user" + }, + "file": { + "link": "http://localhost:9001/rest/data/file" + }, + "msg": { + "link": "http://localhost:9001/rest/data/msg" + }, + "query": { + "link": "http://localhost:9001/rest/data/query" + }, + "issue": { + "link": "http://localhost:9001/rest/data/issue" + } + } + + json_dict = json.loads(f.text) + self.assertEqual(json_dict['data'], expected_data)
