Skip to content

Commit 8ad545e

Browse files
committed
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.
1 parent 21aae94 commit 8ad545e

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

test/test_liveserver.py

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,10 +1507,39 @@ def test_rest_login_RateLimit(self):
15071507
'Allow'),
15081508
'Access-Control-Allow-Origin': 'http://localhost:9001',
15091509
'Access-Control-Allow-Credentials': 'true',
1510-
'Allow': 'OPTIONS, GET, POST, PUT, DELETE, PATCH',
1511-
'Content-Length': '167',
1512-
'Content-Encoding': 'gzip'}
1510+
'Allow': 'OPTIONS, GET, POST, PUT, DELETE, PATCH'
1511+
}
15131512

15141513
for header in headers_expected.keys():
15151514
self.assertEqual(f.headers[header],
15161515
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)

0 commit comments

Comments
 (0)