Mercurial > p > roundup > code
comparison test/test_liveserver.py @ 6526:3c8322e3fe25
Fix test and remove pdb invocation.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 07 Nov 2021 01:47:07 -0500 |
| parents | c505c774a94d |
| children | f8df7fed18f6 |
comparison
equal
deleted
inserted
replaced
| 6525:c505c774a94d | 6526:3c8322e3fe25 |
|---|---|
| 99 # use basic auth for rest endpoint | 99 # use basic auth for rest endpoint |
| 100 f = requests.put(self.url_base() + '/rest/data/user', | 100 f = requests.put(self.url_base() + '/rest/data/user', |
| 101 auth=('admin', 'sekrit'), | 101 auth=('admin', 'sekrit'), |
| 102 headers = {'content-type': "", | 102 headers = {'content-type': "", |
| 103 'x-requested-with': "rest"}) | 103 'x-requested-with': "rest"}) |
| 104 import pdb; pdb.set_trace() | |
| 105 print(f.status_code) | 104 print(f.status_code) |
| 106 print(f.headers) | 105 print(f.headers) |
| 107 print(f.content) | 106 print(f.content) |
| 108 | 107 |
| 109 self.assertEqual(f.status_code, 405) | 108 self.assertEqual(f.status_code, 405) |
| 181 | 180 |
| 182 self.assertEqual(f.status_code, 204) | 181 self.assertEqual(f.status_code, 204) |
| 183 expected = { 'Access-Control-Allow-Origin': '*', | 182 expected = { 'Access-Control-Allow-Origin': '*', |
| 184 'Access-Control-Allow-Headers': 'Content-Type, Authorization, X-Requested-With, X-HTTP-Method-Override', | 183 'Access-Control-Allow-Headers': 'Content-Type, Authorization, X-Requested-With, X-HTTP-Method-Override', |
| 185 'Allow': 'OPTIONS, GET, POST', | 184 'Allow': 'OPTIONS, GET, POST', |
| 186 'Access-Control-Allow-Methods': 'HEAD, OPTIONS, GET, POST, PUT, DELETE, PATCH', | 185 'Access-Control-Allow-Methods': 'OPTIONS, GET, POST', |
| 187 } | 186 } |
| 188 | 187 |
| 189 # use dict comprehension to remove fields like date, | 188 # use dict comprehension to remove fields like date, |
| 190 # content-length etc. from f.headers. | 189 # content-length etc. from f.headers. |
| 191 self.assertDictEqual({ key: value for (key, value) in f.headers.items() if key in expected }, expected) | 190 self.assertDictEqual({ key: value for (key, value) in f.headers.items() if key in expected }, expected) |
