def test_execute_data_json(self): actor = misc.GenericHTTP('Unit Test Action', {'url': 'http://example.com', 'data-json': {'foo': 'bar'}}) actor._fetch = mock_tornado({'success': {'code': 200}}) yield actor.execute()
def test_execute_fail(self): actor = misc.GenericHTTP('Unit Test Action', {'url': 'http://example.com'}) error = httpclient.HTTPError(code=401, response={}) actor._fetch = mock_tornado(exc=error) with self.assertRaises(exceptions.InvalidCredentials): yield actor.execute()
def integration_auth(self): actor = misc.GenericHTTP( 'Test', { 'url': 'http://httpbin.org/basic-auth/unit/test', 'username': '******', 'password': '******' }) yield actor.execute()
def integration_post(self): actor = misc.GenericHTTP('Test', { 'url': 'http://httpbin.org/post', 'data': { 'foo': 'bar' } }) yield actor.execute()
def test_execute_dry(self): actor = misc.GenericHTTP('Unit Test Action', {'url': 'http://example.com'}, dry=True) actor._fetch = mock_tornado() yield actor.execute() self.assertEqual(actor._fetch._call_count, 0)
def integration_auth_fail(self): actor = misc.GenericHTTP( 'Test', { 'url': 'http://httpbin.org/basic-auth/unit/test', 'username': '******', 'password': '******' }) with self.assertRaises(exceptions.InvalidCredentials): yield actor.execute()
def integration_get(self): actor = misc.GenericHTTP('Test', {'url': 'http://httpbin.org/get'}) yield actor.execute()