Esempio n. 1
0
 def test_get(self):
     request = HSRequest(self.client.auth)
     response = request.get(url='http://httpbin.org/get',
                            headers={'Custom-Header': 'Nothing'},
                            parameters={'param': 'Nothing'},
                            get_json=False)
     self.assertEquals(response.status_code, 200)
     response = request.get(url='http://httpbin.org/get', get_json=True)
     self.assertEquals(isinstance(response, dict), True)
 def test_get(self):
     request = HSRequest(self.client.auth)
     response = request.get(
         url="http://httpbin.org/get",
         headers={"Custom-Header": "Nothing"},
         parameters={"param": "Nothing"},
         get_json=False,
     )
     self.assertEquals(response.status_code, 200)
     response = request.get(url="http://httpbin.org/get", get_json=True)
     self.assertEquals(isinstance(response, dict), True)
Esempio n. 3
0
    def test_get_https(self):
        request = HSRequest(self.client.auth)
        response = request.get(url='https://httpbin.org/get',
                               headers={'Custom-Header': 'Nothing'},
                               parameters={'param': 'Nothing'},
                               get_json=False)
        self.assertEquals(response.status_code, 200)
        response = request.get(url='https://httpbin.org/get', get_json=True)
        self.assertEquals(isinstance(response, dict), True)

        try:
            response = request.get(url='https://www.hellosign.com/oauth/token',
                                   get_json=True)
        except BadRequest, e:
            self.assertEquals('400 error' in str(e), True)
    def test_get_https(self):
        request = HSRequest(self.client.auth)
        response = request.get(
            url="https://httpbin.org/get",
            headers={"Custom-Header": "Nothing"},
            parameters={"param": "Nothing"},
            get_json=False,
        )
        self.assertEquals(response.status_code, 200)
        response = request.get(url="https://httpbin.org/get", get_json=True)
        self.assertEquals(isinstance(response, dict), True)

        try:
            response = request.get(url="https://www.hellosign.com/oauth/token", get_json=True)
        except BadRequest, e:
            self.assertEquals("400 error" in str(e), True)
 def test_call(self):
     auth = HSAccessTokenAuth(access_token="at_test",
                              access_token_type="att_test")
     request = HSRequest(auth)
     response = request.get(url='http://httpbin.org/headers')
     self.assertEquals(response['headers']['Authorization'],
                       'at_test att_test')
 def test_call(self):
     auth = HSAccessTokenAuth(access_token="at_test",
                              access_token_type="att_test")
     request = HSRequest(auth)
     response = request.get(url='http://httpbin.org/headers')
     self.assertEquals(response['headers']['Authorization'],
                       'at_test att_test')
Esempio n. 7
0
 def test_not_found(self):
     request = HSRequest(self.client.auth)
     try:
         request.get(url=self.client.API_URL + "/not/found")
     except NotFound:
         pass
Esempio n. 8
0
 def test_not_authorized(self):
     request = HSRequest(HTTPBasicAuth("test", ''))
     try:
         request.get(self.client.ACCOUNT_INFO_URL)
     except Unauthorized:
         pass
Esempio n. 9
0
 def test_not_found(self):
     request = HSRequest(self.client.auth)
     try:
         request.get(url=self.client.API_URL + "/not/found")
     except NotFound:
         pass
Esempio n. 10
0
 def test_not_authorized(self):
     request = HSRequest(HTTPBasicAuth("test", ''))
     try:
         request.get(self.client.ACCOUNT_INFO_URL)
     except Unauthorized:
         pass