예제 #1
0
 def test_404(self):
     conn = Connection(HTTPBIN)
     with self.assertRaises(sleepwalker.exceptions.HTTPNotFound):
         try:
             conn.json_request('GET', httpbin('get/notfound'))
         except sleepwalker.exceptions.HTTPNotFound as hnf:
             self.assertEqual(hnf.http_code, 404)
             raise
예제 #2
0
 def test_json_request(self):
     conn = Connection(HTTPBIN)
     r = conn.json_request('GET', httpbin('get'))
     self.assertEqual(r['headers']['Accept'], 'application/json')
     self.assertEqual(r['headers']['Content-Type'], 'application/json')
     self.assertEqual(conn.response.status_code, 200)