def test_validate_pagination_params_no_content(self): with self.app.test_request_context('/?limit=10&start=0', method='GET'): with patch.object(Interactions, 'list', return_value=[]): response = paginate( request, DEFAULT_ACCOUNTS_TABLE, 'accounts' ) self.assertEqual(response.status_code, client.NO_CONTENT)
def get(self): """ Get the user's registered webhooks """ account_id = lookup_account_id(request.headers['username']) return paginate(request, DEFAULT_REGISTRATIONS_TABLE, 'registrations', filters={'account_id': account_id})
def test_validate_pagination_params_wth_next_marker(self): with self.app.test_request_context('/?limit=1&start=0', method='GET'): with patch.object(Interactions, 'list', return_value=self.returned_records): response = paginate(request, DEFAULT_ACCOUNTS_TABLE, 'accounts') self.assertTrue('next_start' in str(response.data)) self.assertEqual(response.status_code, client.OK)
def test_validate_pagination_params_wth_next_marker(self): with self.app.test_request_context('/?limit=1&start=0', method='GET'): with patch.object(Interactions, 'list', return_value=self.returned_records): response = paginate( request, DEFAULT_ACCOUNTS_TABLE, 'accounts' ) self.assertTrue('next_start' in str(response.data)) self.assertEqual(response.status_code, client.OK)
def get(self): """ Get the user's webhook subscriptions """ try: account_id = lookup_account_id(request.headers['username']) # pylint: disable=W0703 except Exception: return make_response( jsonify({'Error': 'Invalid username or account'}), client.BAD_REQUEST) return paginate(request, DEFAULT_SUBSCRIPTIONS_TABLE, 'subscriptions', filters={'account_id': account_id})
def get(self): """ Get a listing of accounts (paginated if need be) """ return paginate(request, DEFAULT_ACCOUNTS_TABLE, 'accounts')
def get(self): """ Get a listing of Registrations (paginated if need be) """ return paginate(request, DEFAULT_REGISTRATIONS_TABLE, 'registrations')
def get(self): """ Get a listing of triggered webhooks (paginated if need be) """ return paginate(request, DEFAULT_TRIGGERED_TABLE, 'triggered_webhooks')
def test_validate_pagination_params_no_content(self): with self.app.test_request_context('/?limit=10&start=0', method='GET'): with patch.object(Interactions, 'list', return_value=[]): response = paginate(request, DEFAULT_ACCOUNTS_TABLE, 'accounts') self.assertEqual(response.status_code, client.NO_CONTENT)
def get(self): """ Get a listing of subscriptions (paginated if need be) """ return paginate(request, DEFAULT_SUBSCRIPTIONS_TABLE, 'subscriptions')