예제 #1
0
 def test_raises_error_if_over_400(self):
     res = requests.Response()
     res.status_code = 400
     with self.assertRaises(dwollav2.Error):
         dwollav2.Response(res)
예제 #2
0
 def test_sets_json_body(self):
     res = requests.Response()
     res.status_code = 200
     res._content = '{"foo":"bar"}'.encode()
     dres = dwollav2.Response(res)
     self.assertEqual(res.json(), dres.body)
예제 #3
0
 def test_sets_headers(self):
     res = requests.Response()
     res.status_code = 200
     res.headers = {'foo': 'bar'}
     dres = dwollav2.Response(res)
     self.assertEqual(res.headers, dres.headers)
예제 #4
0
 def test_sets_text_body(self):
     res = requests.Response()
     res.status_code = 200
     res._content = 'foo bar'.encode()
     dres = dwollav2.Response(res)
     self.assertEqual(res.text, dres.body)
예제 #5
0
 def test_sets_status(self):
     res = requests.Response()
     res.status_code = 200
     dres = dwollav2.Response(res)
     self.assertEqual(res.status_code, dres.status)