コード例 #1
0
 def test_post_https(self):
     request = HSRequest(self.client.auth)
     response = request.post(url='https://httpbin.org/post',
                             data={"test": "None"},
                             get_json=False,
                             headers={'Custom-Header': 'Nothing'})
     self.assertEqual(response.status_code, 200)
     response = request.post(url='https://httpbin.org/post',
                             data={"test": "None"},
                             get_json=True)
コード例 #2
0
 def test_bad_request(self):
     request = HSRequest(self.client.auth, self.env)
     try:
         request.post(url=self.client.ACCOUNT_UPDATE_URL,
                      data={"bad": "request"})
         self.fail("BadRequest was expected")
     except BadRequest:
         pass
     except BaseException as e:
         self.fail("BadRequest was expected but got %s instead" %
                   e.__class__.__name__)