Beispiel #1
0
 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()
Beispiel #2
0
 def test_no_api_secret(self):
     configuration.api_secret = ''
     with self.assertRaises(ConfigurationError):
         Api().call(command())
Beispiel #3
0
 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())
Beispiel #4
0
 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)
Beispiel #5
0
 def test_init(self):
     self.assertIsInstance(Api().req, ApisRequest)
Beispiel #6
0
 def retrieve(review_id):
     return Api().call(CommandsReview({}).build(review_id))
Beispiel #7
0
 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()