test_LORIS_Query.test_checkPSCIDExist()   A
last analyzed

Complexity

Conditions 4

Size

Total Lines 8
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 4
nop 0
1
from LORIS_query import login, getCNBP
2
from LORIS_candidates import checkDCCIDExist, checkPSCIDExist
3
import sqlite3
4
from pathlib import Path
5
import logging
6
import os
7
import sys
8
9
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
10
11
def test_LORIS_login():
12
    logger = logging.getLogger('UT_LORIS_login')
13
    response_success, token = login()
14
    assert response_success
15
    #assert len(token) == 256 #token should always be 256 char long
16
17
def test_LORIS_get():
18
    logger = logging.getLogger('UT_LORIS_get')
19
    response_success, token = login()
20
    assert response_success
21
    #assert len(token) == 256  # token should always be 256 char long
22
    response_success, json = getCNBP(token, "projects")
23
    assert response_success
24
    response_success, json = getCNBP(token, "candidates")
25
    assert response_success
26
27
def test_checkPSCIDExist():
28
    logger = logging.getLogger('UT_LORIS_PSCID_check')
29
    response_success, token = login()
30
    assert response_success
31
    #assert len(token) == 256  # token should always be 256 char long
32
    response_success, exist = checkPSCIDExist(token, "CNBP0010001")
33
    assert response_success
34
    assert exist
35
36
def test_checkDCCIDExist():
37
    logger = logging.getLogger('UT_LORIS_DCCID_check')
38
    response_success, token = login()
39
    assert response_success
40
    #assert len(token) == 256  # token should always be 256 char long
41
    response_success, exist = checkDCCIDExist(token, 272264)
42
    assert response_success
43
    assert exist
44
45
if __name__ == '__main__':
46
    test_checkPSCIDExist()
47