test_Intermediate_Server   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 20
dl 0
loc 37
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A test_updateLocalTimepoint() 0 29 3
1
from LORIS_query import login
2
from LocalDB_create_CNBP import create_localDB_CNBP
3
from LocalDB_schema import *
4
from LocalDB_query import create_entry, update_entry
5
from Intermediate_LORIS_LocalDB import findTimePointUpdateDatabase
6
7
8
def test_updateLocalTimepoint():
9
    import os
10
    database_path = "Test.sqlite"
11
    DCCID = 642461
12
    table_name = CNBP_schema_table_name
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable CNBP_schema_table_name does not seem to be defined.
Loading history...
13
14
    # Remove database if previously existed.
15
    if os.path.exists(database_path):
16
        os.remove(database_path)
17
18
    # Create Database
19
    create_localDB_CNBP(database_path)
20
21
    # Get login token:
22
    success, token = login()
23
24
    # Create the entry with the right PSCID with proper DCCID on dev.cnbp.ca
25
    create_entry(database_path, table_name, CNBP_schema_keyfield, 9999999999)
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable CNBP_schema_keyfield does not seem to be defined.
Loading history...
26
27
    # Update above entry with the right mock PSCID.
28
    update_entry(database_path, table_name, CNBP_schema_keyfield, 9999999999, "DCCID", DCCID, )
29
30
    # Now, the big guy.
31
    success, reason = findTimePointUpdateDatabase(token, DCCID, database_path, table_name)
32
33
    # Clean up database.
34
    os.remove(database_path)
35
36
    assert success