|
1
|
|
|
import logging |
|
|
|
|
|
|
2
|
|
|
import sys |
|
3
|
|
|
from LORIS.query import login, getCNBP |
|
|
|
|
|
|
4
|
|
|
from LORIS.candidates import checkDCCIDExist, checkPSCIDExist |
|
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
logging.basicConfig(stream=sys.stdout, level=logging.INFO) |
|
7
|
|
|
|
|
8
|
|
|
def test_LORIS_login(): |
|
|
|
|
|
|
9
|
|
|
logger = logging.getLogger('UT_LORIS_login') |
|
|
|
|
|
|
10
|
|
|
response_success, token = login() |
|
|
|
|
|
|
11
|
|
|
assert response_success |
|
12
|
|
|
#assert len(token) == 256 #token should always be 256 char long |
|
13
|
|
|
|
|
14
|
|
|
def test_LORIS_get(): |
|
|
|
|
|
|
15
|
|
|
logger = logging.getLogger('UT_LORIS_get') |
|
|
|
|
|
|
16
|
|
|
response_success, token = login() |
|
17
|
|
|
assert response_success |
|
18
|
|
|
#assert len(token) == 256 # token should always be 256 char long |
|
19
|
|
|
response_success, json = getCNBP(token, "projects") |
|
|
|
|
|
|
20
|
|
|
assert response_success |
|
21
|
|
|
response_success, json = getCNBP(token, "candidates") |
|
22
|
|
|
assert response_success |
|
23
|
|
|
|
|
24
|
|
|
def test_checkPSCIDExist(): |
|
|
|
|
|
|
25
|
|
|
logger = logging.getLogger('UT_LORIS_PSCID_check') |
|
|
|
|
|
|
26
|
|
|
response_success, token = login() |
|
27
|
|
|
assert response_success |
|
28
|
|
|
#assert len(token) == 256 # token should always be 256 char long |
|
29
|
|
|
response_success, exist = checkPSCIDExist(token, "CNBP0010001") |
|
30
|
|
|
assert response_success |
|
31
|
|
|
assert exist |
|
32
|
|
|
|
|
33
|
|
|
def test_checkDCCIDExist(): |
|
|
|
|
|
|
34
|
|
|
logger = logging.getLogger('UT_LORIS_DCCID_check') |
|
|
|
|
|
|
35
|
|
|
response_success, token = login() |
|
36
|
|
|
assert response_success |
|
37
|
|
|
#assert len(token) == 256 # token should always be 256 char long |
|
38
|
|
|
response_success, exist = checkDCCIDExist(token, 272264) |
|
39
|
|
|
assert response_success |
|
40
|
|
|
assert exist |
|
41
|
|
|
|
|
42
|
|
|
if __name__ == '__main__': |
|
43
|
|
|
test_checkPSCIDExist() |
|
44
|
|
|
|
This check looks for invalid names for a range of different identifiers.
You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.
If your project includes a Pylint configuration file, the settings contained in that file take precedence.
To find out more about Pylint, please refer to their site.