Passed
Pull Request — master (#3)
by Yang
04:58
created

UT_LORISQuery.test_checkDCCIDExist()   A

Complexity

Conditions 1

Size

Total Lines 9
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nop 0
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
import logging
0 ignored issues
show
Coding Style introduced by
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2
import sys
3
from LORIS.query import LORIS_query
0 ignored issues
show
introduced by
Unable to import 'LORIS.query'
Loading history...
4
from LORIS.candidates import LORIS_candidates
0 ignored issues
show
introduced by
Unable to import 'LORIS.candidates'
Loading history...
5
6
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
7
import unittest
0 ignored issues
show
introduced by
Import "import unittest" should be placed at the top of the module
Loading history...
introduced by
standard import "import unittest" should be placed before "from LORIS.query import LORIS_query"
Loading history...
8
class UT_LORISQuery(unittest.TestCase):
0 ignored issues
show
Coding Style Naming introduced by
The name UT_LORISQuery does not conform to the class naming conventions ([A-Z_][a-zA-Z0-9]+$).

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.

Loading history...
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Unused Code introduced by
The variable __class__ seems to be unused.
Loading history...
9
10
    @staticmethod
11
    def test_LORIS_login():
0 ignored issues
show
Coding Style Naming introduced by
The name test_LORIS_login does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

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.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
12
        logger = logging.getLogger('UT_LORIS_login')
0 ignored issues
show
Unused Code introduced by
The variable logger seems to be unused.
Loading history...
13
        response_success, token = LORIS_query.login()
0 ignored issues
show
Unused Code introduced by
The variable token seems to be unused.
Loading history...
14
        assert response_success
15
16
        #assert len(token) == 256 #token should always be 256 char long
17
    @staticmethod
18
    def test_LORIS_get():
0 ignored issues
show
Coding Style Naming introduced by
The name test_LORIS_get does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

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.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
19
        logger = logging.getLogger('UT_LORIS_get')
0 ignored issues
show
Unused Code introduced by
The variable logger seems to be unused.
Loading history...
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")
0 ignored issues
show
Unused Code introduced by
The variable json seems to be unused.
Loading history...
24
        assert response_success
25
        response_success, json = LORIS_query.getCNBP(token, "candidates")
26
        assert response_success
27
28
    @staticmethod
29
    def test_checkPSCIDExist():
0 ignored issues
show
Coding Style Naming introduced by
The name test_checkPSCIDExist does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

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.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
30
        logger = logging.getLogger('UT_LORIS_PSCID_check')
0 ignored issues
show
Unused Code introduced by
The variable logger seems to be unused.
Loading history...
31
        response_success, token = LORIS_query.login()
32
        assert response_success
33
        #assert len(token) == 256  # token should always be 256 char long
34
        response_success, exist = LORIS_candidates.checkPSCIDExist(token, "CNBP0010001")
35
        assert response_success
36
        assert not exist
37
38
    @staticmethod
39
    def test_checkDCCIDExist():
0 ignored issues
show
Coding Style Naming introduced by
The name test_checkDCCIDExist does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

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.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
40
        logger = logging.getLogger('UT_LORIS_DCCID_check')
0 ignored issues
show
Unused Code introduced by
The variable logger seems to be unused.
Loading history...
41
        response_success, token = LORIS_query.login()
42
        assert response_success
43
        #assert len(token) == 256  # token should always be 256 char long
44
        response_success, exist = LORIS_candidates.checkDCCIDExist(token, 272264)
45
        assert response_success
46
        assert exist
47
48
49
if __name__ == '__main__':
50
    UT_LORISQuery.test_checkPSCIDExist()
51