-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
159 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from pynequa.models import QueryParams | ||
import unittest | ||
import logging | ||
|
||
|
||
class TestQueryParams(unittest.TestCase): | ||
|
||
def test_query_params_payload(self): | ||
""" | ||
Test if query params payload is correctly | ||
generated or not. | ||
""" | ||
qp = QueryParams( | ||
name="query", | ||
search_text="What was Landsat-9 launched?" | ||
) | ||
|
||
payload = qp.generate_payload() | ||
logging.debug(payload) | ||
|
||
keys_which_must_be_in_payload = [ | ||
"name", | ||
"text", | ||
"isFirstpage", | ||
"strictRefine", | ||
"removeDuplicates" | ||
] | ||
|
||
for key in keys_which_must_be_in_payload: | ||
if key not in payload: | ||
self.assertEqual(key, "test", f"{key} is mising in payload") | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |