Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rest: Add pagination support #1361

Merged
merged 1 commit into from
Nov 13, 2023

Conversation

erikoqvist
Copy link
Contributor

No description provided.

else:
if search_options['include_neighbors'] not in (True, False):
raise NipapValueError("Invalid value for option 'include_neighbors'. Only true and false valid. "
"Supplied value: '{}'".format(search_options['include_neighbors']))

# max_result
if 'max_result' not in search_options:
search_options['max_result'] = 50
search_options['max_result'] = prefix_search_options_spec['max_result']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (83 > 79 characters)

@@ -3159,15 +3173,15 @@ def search_prefix(self, auth, query, search_options=None):

# include_neighbors
if 'include_neighbors' not in search_options:
search_options['include_neighbors'] = False
search_options['include_neighbors'] = prefix_search_options_spec['include_neighbors']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (97 > 79 characters)

@@ -3150,7 +3164,7 @@ def search_prefix(self, auth, query, search_options=None):

# children_depth
if 'children_depth' not in search_options:
search_options['children_depth'] = 0
search_options['children_depth'] = prefix_search_options_spec['children_depth']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (91 > 79 characters)

else:
if search_options['include_all_children'] not in (True, False):
raise NipapValueError("Invalid value for option 'include_all_children'. Only true and false valid. "
"Supplied value: '{}'".format(search_options['include_all_children']))

# parents_depth
if 'parents_depth' not in search_options:
search_options['parents_depth'] = 0
search_options['parents_depth'] = prefix_search_options_spec['parents_depth']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (89 > 79 characters)

@@ -3133,15 +3147,15 @@ def search_prefix(self, auth, query, search_options=None):

# include_children
if 'include_all_children' not in search_options:
search_options['include_all_children'] = False
search_options['include_all_children'] = prefix_search_options_spec['include_all_children']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (103 > 79 characters)

@@ -233,7 +237,7 @@ def get(self, args):
}

try:
result = self.nip.search_prefix(args.get('auth'), search_query)
result = self.nip.search_prefix(args.get('auth'), search_query, search_options)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (91 > 79 characters)


# Test offset 75
parameters['offset'] = 35
get_prefix_request = requests.get(self.server_url, headers=self.headers, params=parameters)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (99 > 79 characters)


# Test max result 100
parameters['max_result'] = 60
get_prefix_request = requests.get(self.server_url, headers=self.headers, params=parameters)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (99 > 79 characters)

parameters = {'order_id': 'test'}

# Test default max result of 50 amd offset 0
get_prefix_request = requests.get(self.server_url, headers=self.headers, params=parameters)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (99 > 79 characters)

@@ -481,6 +481,45 @@ def test_prefix_search_error_message(self):

self.assertTrue(get_prefix_request.text.__contains__('\'prefixeere\' unknown'))

def test_prefix_pagination(self):
""" Add prefixes with the same order_id, expect different number of prefixes in result

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (86 > 79 characters)

@garberg
Copy link
Member

garberg commented Nov 13, 2023

Upgrade tests due to NIPAP not properly restarting after the upgrade. I'm working on that one... LGTM!

@garberg garberg merged commit 67d2196 into SpriteLink:master Nov 13, 2023
4 of 5 checks passed
@erikoqvist erikoqvist deleted the add_pagination_to_rest_api branch May 14, 2024 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants