comparison 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
comparison
equal deleted inserted replaced
7556:273c8c2b5042 7557:7b481ec7f169
1505 'Retry-After, ' 1505 'Retry-After, '
1506 'Sunset, ' 1506 'Sunset, '
1507 'Allow'), 1507 'Allow'),
1508 'Access-Control-Allow-Origin': 'http://localhost:9001', 1508 'Access-Control-Allow-Origin': 'http://localhost:9001',
1509 'Access-Control-Allow-Credentials': 'true', 1509 'Access-Control-Allow-Credentials': 'true',
1510 'Allow': 'OPTIONS, GET, POST, PUT, DELETE, PATCH', 1510 'Allow': 'OPTIONS, GET, POST, PUT, DELETE, PATCH'
1511 'Content-Length': '167', 1511 }
1512 'Content-Encoding': 'gzip'}
1513 1512
1514 for header in headers_expected.keys(): 1513 for header in headers_expected.keys():
1515 self.assertEqual(f.headers[header], 1514 self.assertEqual(f.headers[header],
1516 headers_expected[header]) 1515 headers_expected[header])
1516
1517 expected_data = {
1518 "status": {
1519 "link": "http://localhost:9001/rest/data/status"
1520 },
1521 "keyword": {
1522 "link": "http://localhost:9001/rest/data/keyword"
1523 },
1524 "priority": {
1525 "link": "http://localhost:9001/rest/data/priority"
1526 },
1527 "user": {
1528 "link": "http://localhost:9001/rest/data/user"
1529 },
1530 "file": {
1531 "link": "http://localhost:9001/rest/data/file"
1532 },
1533 "msg": {
1534 "link": "http://localhost:9001/rest/data/msg"
1535 },
1536 "query": {
1537 "link": "http://localhost:9001/rest/data/query"
1538 },
1539 "issue": {
1540 "link": "http://localhost:9001/rest/data/issue"
1541 }
1542 }
1543
1544 json_dict = json.loads(f.text)
1545 self.assertEqual(json_dict['data'], expected_data)

Roundup Issue Tracker: http://roundup-tracker.org/