示例#1
0
 def test_get_cars_access_403(self):
     responses.add(
         responses.GET,
         host + "/users/me/cars",
         json=[{
             'type': 'AUTHORIZATION_ERROR',
             'message': "Token can't access this user",
             'tip': "Make sure the trip belongs to the user you asked for"
         }],
         status=403)
     cars, err = xee.get_cars("oops")
     self.assertIsNone(cars)
     self.assertEqual(
         err,
         APIException(
             'AUTHORIZATION_ERROR', "Token can't access this user",
             "Make sure the trip belongs to the user you asked for"))
示例#2
0
 def test_get_cars_404(self):
     responses.add(
         responses.GET,
         host + "/users/me/cars",
         json=[{
             'type':
             'PARAMETERS_ERROR',
             'message':
             "User not found",
             'tip':
             "Please check that the user exists, looks like it does not"
         }],
         status=404)
     cars, err = xee.get_cars("oops")
     self.assertIsNone(cars)
     self.assertEqual(
         err,
         APIException(
             'PARAMETERS_ERROR', "User not found",
             "Please check that the user exists, looks like it does not"))
示例#3
0
 def test_get_cars_scope_403(self):
     responses.add(
         responses.GET,
         host + "/users/me/cars",
         json=[{
             'type':
             'AUTHORIZATION_ERROR',
             'message':
             "Token does not have the required scope",
             'tip':
             "Add the cars_read scope to your app scopes and reconnect the user"
         }],
         status=403)
     cars, err = xee.get_cars("oops")
     self.assertIsNone(cars)
     self.assertEqual(
         err,
         APIException(
             'AUTHORIZATION_ERROR',
             "Token does not have the required scope",
             "Add the cars_read scope to your app scopes and reconnect the user"
         ))