def test_query_rql_driver_error(self):
     with self.app.test_request_context():
         with patch.object(Interactions, 'get',
                           side_effect=RqlDriverError(None)):
             response = query(DEFAULT_REGISTRATIONS_TABLE, record_id='123')
             self.assertRaises(RqlDriverError)
             self.assertEqual(response.status_code,
                              client.INTERNAL_SERVER_ERROR)
示例#2
0
 def get(self, account_id):
     """
     Gets a user account. Users can only see their own account
     """
     if lookup_account_id(request.headers['username']) == account_id:
         return query(DEFAULT_ACCOUNTS_TABLE, account_id)
     else:
         return make_response(jsonify(
             {'Error': 'Not authorized'}),
             client.UNAUTHORIZED)
 def test_query(self):
     with self.app.test_request_context():
         with patch.object(Interactions, "get", return_value={}):
             response = query(DEFAULT_REGISTRATIONS_TABLE, record_id="123")
             self.assertEqual(response.status_code, client.OK)
 def test_query(self):
     with self.app.test_request_context():
         with patch.object(Interactions, 'get', return_value={}):
             response = query(DEFAULT_REGISTRATIONS_TABLE, record_id='123')
             self.assertEqual(response.status_code, client.OK)