-
Notifications
You must be signed in to change notification settings - Fork 132
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
rest: Add pagination support #1361
Conversation
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'] |
There was a problem hiding this comment.
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'] |
There was a problem hiding this comment.
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'] |
There was a problem hiding this comment.
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'] |
There was a problem hiding this comment.
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'] |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)
3b666fb
to
2bef229
Compare
Upgrade tests due to NIPAP not properly restarting after the upgrade. I'm working on that one... LGTM! |
No description provided.