-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
e2e integration tests + little addition to helper function
- Loading branch information
1 parent
3fe9e72
commit ff42429
Showing
3 changed files
with
64 additions
and
1 deletion.
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,34 @@ | ||
import unittest | ||
from collections import defaultdict | ||
from unittest.mock import patch | ||
import asyncio | ||
|
||
from functions.funcs import helper_function_exam, get_uuser_list_exam | ||
|
||
class TestIntegration(unittest.TestCase): | ||
|
||
@patch('functions.funcs.fetch') | ||
def test_helper_func_fetch_empty(self, mock_fetch): | ||
async def async_test(): | ||
mock_fetch.return_value = [] | ||
res = await helper_function_exam() | ||
|
||
self.assertIsInstance(res, dict) | ||
self.assertTrue(res == {"msg":"error"}) | ||
|
||
asyncio.run(async_test()) | ||
|
||
@patch('functions.funcs.helper_function_exam') | ||
def test_exam_return_endpoint(self, mock_helper): | ||
async def async_test(): | ||
mock_helper.return_value = "failure" | ||
|
||
res = await get_uuser_list_exam() | ||
self.assertIsInstance(res, dict) | ||
self.assertTrue(res == {"err": "some error"}) | ||
|
||
asyncio.run(async_test()) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |