def test_request(self, mock_request): transport = Transport() transport.request('act') mock_request.assert_called_with( 'http://api.clickatell.com/act', params={}, data='{}', headers={'User-Agent': 'ClickatellPython/0.1.0 httplib2 Python/' + platform.python_version()} )
def test_request(self, mock_request): transport = Transport() transport.request('act') mock_request.assert_called_with('http://api.clickatell.com/act', params={}, data='{}', headers={ 'User-Agent': 'ClickatellPython/0.1.2 Python/' + platform.python_version() })
def request(self, action, data={}, headers={}, method='GET'): """ Append the user authentication details to every incoming request """ data = self.merge(data, { 'user': self.username, 'password': self.password, 'api_id': self.apiId }) return Transport.request(self, action, data, headers, method)
def request(self, action, data={}, headers={}, method='GET'): """ Append the REST headers to every request """ headers = { "Authorization": self.apiKey, "Content-Type": "application/json", "Accept": "application/json" } return Transport.request(self, action, data, headers, method)
def request(self, action, data={}, headers={}, method='GET'): """ Append the REST headers to every request """ headers = { "Authorization": "Bearer " + self.token, "Content-Type": "application/json", "X-Version": "1", "Accept": "application/json" } return Transport.request(self, action, data, headers, method)
def request(self, action, data={}, headers={}, method='GET'): """ Append the user authentication details to every incoming request """ data = self.merge(data, {'user': self.username, 'password': self.password, 'api_id': self.apiId}) return Transport.request(self, action, data, headers, method)
def test_request_return(self): transport = Transport() text = transport.request('404') # content is expected to return as a string self.assertFalse(isinstance(text, bytes))
def request(self, action, data={}, headers={}, method='GET'): """ Append the user authentication details to every incoming request """ data = self.merge(data, {'apiKey': self.apiKey}) return Transport.request(self, action, data, headers, method)