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

UT_LORISHelper.test_ProxyUpload()   A

Complexity

Conditions 1

Size

Total Lines 22
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 19
nop 0
dl 0
loc 22
rs 9.45
c 0
b 0
f 0
1
import os
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 unittest
3
from LORIS.helper import LORIS_helper
0 ignored issues
show
introduced by
Unable to import 'LORIS.helper'
Loading history...
4
from dotenv import load_dotenv
5
from pathlib import Path
0 ignored issues
show
introduced by
standard import "from pathlib import Path" should be placed before "from LORIS.helper import LORIS_helper"
Loading history...
6
7
class UT_LORISHelper(unittest.TestCase):
0 ignored issues
show
Coding Style Naming introduced by
The name UT_LORISHelper 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...
8
9
    @staticmethod
10
    def test_number_extraction():
0 ignored issues
show
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...
11
        Prefix = "V"
0 ignored issues
show
Coding Style Naming introduced by
The name Prefix does not conform to the variable 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...
12
        numbers = [1, 2, 3, 9, 10, 11, 12, 100, 101, 102]
13
14
        global timepoints
0 ignored issues
show
Coding Style Naming introduced by
The name timepoints does not conform to the constant naming conventions ((([A-Z_][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...
Bug introduced by
Global variable 'timepoints' undefined at the module level
Loading history...
15
        timepoints = []
16
17
        for number in numbers:
18
            timepoints.append(Prefix + str(number))
19
20
        DualList = zip(numbers, timepoints)
0 ignored issues
show
Coding Style Naming introduced by
The name DualList does not conform to the variable 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...
21
22
        for tupleItem in DualList:
0 ignored issues
show
Coding Style Naming introduced by
The name tupleItem does not conform to the variable 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...
23
            assert str(tupleItem[0]) == LORIS_helper.number_extraction(tupleItem[1])[0]
24
25
26
    @staticmethod
27
    def test_ProxyUpload():
0 ignored issues
show
Coding Style Naming introduced by
The name test_ProxyUpload 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...
28
        assert load_dotenv()
29
30
        ProxyIP = os.getenv("ProxyIP")
0 ignored issues
show
Coding Style Naming introduced by
The name ProxyIP does not conform to the variable 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...
31
        ProxyUsername = os.getenv("ProxyUsername")
0 ignored issues
show
Coding Style Naming introduced by
The name ProxyUsername does not conform to the variable 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...
32
        ProxyPassword = os.getenv("ProxyPassword")
0 ignored issues
show
Coding Style Naming introduced by
The name ProxyPassword does not conform to the variable 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...
33
        LORISHostPassword = os.getenv("LORISHostPassword")
0 ignored issues
show
Coding Style Naming introduced by
The name LORISHostPassword does not conform to the variable 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...
34
        LORISHostUsername = os.getenv("LORISHostUsername")
0 ignored issues
show
Coding Style Naming introduced by
The name LORISHostUsername does not conform to the variable 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...
35
        LORISHostIP = os.getenv("LORISHostIP")
0 ignored issues
show
Coding Style Naming introduced by
The name LORISHostIP does not conform to the variable 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...
36
        Client = LORIS_helper.getProxySSHClient(ProxyIP, ProxyUsername, ProxyPassword,
0 ignored issues
show
Coding Style Naming introduced by
The name Client does not conform to the variable 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...
37
                                                LORISHostIP, LORISHostUsername, LORISHostPassword)
38
39
        testFile = "test_file.txt"
0 ignored issues
show
Coding Style Naming introduced by
The name testFile does not conform to the variable 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...
40
        Path(testFile).touch()
41
42
        LORIS_helper.uploadThroughClient(Client, testFile, testFile)
43
        sftp = Client.open_sftp()
44
        sftp.remove(testFile)
45
        os.remove(testFile)
46
        sftp.close()
47
        Client.close()
48
49
if __name__ == '__main__':
50
    UT_LORISHelper.test_number_extraction()
0 ignored issues
show
Coding Style introduced by
Final newline missing
Loading history...