def __init__(self, context, options=None): if options is None: options = {} self.do_not_track = options.get('do_not_track', False) self.timestamp = options.get('timestamp') self.context = context self.api = Api()
def test_no_api_secret(self): configuration.api_secret = '' with self.assertRaises(ConfigurationError): Api().call(command())
def test_call(self): responses.add(responses.POST, 'https://api.castle.io/v1/authenticate', json=response_text(), status=200) self.assertEqual(Api().call(command()), response_text())
def test_request(self): responses.add(responses.POST, 'https://api.castle.io/v1/authenticate', json=response_text(), status=200) self.assertIsInstance(Api().request(command()), Response)
def test_init(self): self.assertIsInstance(Api().req, ApisRequest)
def retrieve(review_id): return Api().call(CommandsReview({}).build(review_id))
def __init__(self, request, options): self.options = options or dict() self.do_not_track = self.default_tracking() self.cookies = self.setup_cookies(request) self.context = self.setup_context(request) self.api = Api()