| Total Complexity | 4 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import logging |
||
|
|
|||
| 2 | import sys |
||
| 3 | from LORIS.query import LORIS_query |
||
| 4 | from LORIS.candidates import LORIS_candidates |
||
| 5 | |||
| 6 | logging.basicConfig(stream=sys.stdout, level=logging.INFO) |
||
| 7 | logger = logging.getLogger(__name__) |
||
| 8 | |||
| 9 | import unittest |
||
| 10 | class UT_LORISQuery(unittest.TestCase): |
||
| 11 | |||
| 12 | @staticmethod |
||
| 13 | def test_LORIS_login(): |
||
| 14 | response_success, token = LORIS_query.login() |
||
| 15 | assert response_success |
||
| 16 | |||
| 17 | #assert len(token) == 256 #token should always be 256 char long |
||
| 18 | @staticmethod |
||
| 19 | def test_LORIS_get(): |
||
| 20 | response_success, token = LORIS_query.login() |
||
| 21 | assert response_success |
||
| 22 | #assert len(token) == 256 # token should always be 256 char long |
||
| 23 | response_success, json = LORIS_query.getCNBP(token, "projects") |
||
| 24 | assert response_success |
||
| 25 | response_success, json = LORIS_query.getCNBP(token, "candidates") |
||
| 26 | assert response_success |
||
| 27 | |||
| 28 | @staticmethod |
||
| 29 | def test_checkPSCIDExist(): |
||
| 30 | response_success, token = LORIS_query.login() |
||
| 31 | assert response_success |
||
| 32 | #assert len(token) == 256 # token should always be 256 char long |
||
| 33 | response_success, exist = LORIS_candidates.checkPSCIDExist(token, "CNBP0010001") |
||
| 34 | assert response_success |
||
| 35 | assert not exist |
||
| 36 | |||
| 37 | @staticmethod |
||
| 38 | def test_checkDCCIDExist(): |
||
| 39 | response_success, token = LORIS_query.login() |
||
| 40 | assert response_success |
||
| 41 | #assert len(token) == 256 # token should always be 256 char long |
||
| 42 | response_success, exist = LORIS_candidates.checkDCCIDExist(token, 272264) |
||
| 43 | assert response_success |
||
| 44 | assert exist |
||
| 45 | |||
| 46 | |||
| 47 | if __name__ == '__main__': |
||
| 48 | UT_LORISQuery.test_checkPSCIDExist() |
||
| 49 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.