hlcc 2.0.0-beta2+pre1
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
file_helper_test.FileHelperTest Class Reference

This is a test-utility for file_helper.find_file. More...

Public Member Functions

def __init__ (self, p_test_dir)
 Create the whole test setup in the file system.
 
def __del__ (self)
 Removes the test setup from file system and also deletes the test environment variables.
 
def touch (self, path)
 Creates an empty file in the given path.
 
def test_file_not_found (self)
 Searches for a non-existent file and check the output is empty path as expected.
 
def test_file_not_found_with_exception (self)
 Searches for a non-existent file and check it raises an exception as expected.
 
def test_invalid_environment_var (self)
 Searches a file with an invalid root directory and check we get a response which should be empty path.
 
def test_file_found_directly_environment_path (self)
 Searches a file which is directly in one of the root directories and the expected response should be the path of the file meaning it was found.
 
def test_file_found_environment_resource_path (self)
 Searches a file which is in one of resource directories provided after one of the the root directories.
 
def test_file_found_in_cwd (self)
 Move the cwd to the file directory and check if finds it regardless of the root and resource directories.
 
def test_file_found_in_full_path (self)
 Searches a file with its full path and check if still finds the file regardless of the root and resource directories.
 

Public Attributes

 root_path
 home directory
 
 test_dir
 current test directory
 
 test_path
 
 test_dir1_path
 ~/.file_helper_test/dir_1/oldb/file_1.yaml
 
 test_dir1_oldb_path
 
 test_dir1_oldb_file_1_path
 
 test_dir2_path
 ~/.file_helper_test/dir_2/config/file_2.yaml
 
 test_dir2_conf_path
 
 test_dir2_conf_file_2_path
 
 test_dir3_path
 ~/.file_helper_test/dir_3/config/file_3.yaml
 
 test_dir3_conf_path
 
 test_dir3_conf_file_3_path
 

Detailed Description

This is a test-utility for file_helper.find_file.

Constructor & Destructor Documentation

◆ __init__()

def file_helper_test.FileHelperTest.__init__ (   self,
  p_test_dir 
)

Create the whole test setup in the file system.

We are using the home directory as root for our testing. In the Home directory we create a directory given as parameter 'p_test_dir' which is used to create a directory structure so we ca test properly the find_file method. In the end of the test the directory is removed.

◆ __del__()

def file_helper_test.FileHelperTest.__del__ (   self)

Removes the test setup from file system and also deletes the test environment variables.

Member Function Documentation

◆ test_file_found_directly_environment_path()

def file_helper_test.FileHelperTest.test_file_found_directly_environment_path (   self)

Searches a file which is directly in one of the root directories and the expected response should be the path of the file meaning it was found.

◆ test_file_found_environment_resource_path()

def file_helper_test.FileHelperTest.test_file_found_environment_resource_path (   self)

Searches a file which is in one of resource directories provided after one of the the root directories.

and the expected response should be the path of the file meaning it was found

◆ test_file_found_in_cwd()

def file_helper_test.FileHelperTest.test_file_found_in_cwd (   self)

Move the cwd to the file directory and check if finds it regardless of the root and resource directories.

◆ test_file_found_in_full_path()

def file_helper_test.FileHelperTest.test_file_found_in_full_path (   self)

Searches a file with its full path and check if still finds the file regardless of the root and resource directories.

◆ test_file_not_found()

def file_helper_test.FileHelperTest.test_file_not_found (   self)

Searches for a non-existent file and check the output is empty path as expected.

◆ test_file_not_found_with_exception()

def file_helper_test.FileHelperTest.test_file_not_found_with_exception (   self)

Searches for a non-existent file and check it raises an exception as expected.

◆ test_invalid_environment_var()

def file_helper_test.FileHelperTest.test_invalid_environment_var (   self)

Searches a file with an invalid root directory and check we get a response which should be empty path.

◆ touch()

def file_helper_test.FileHelperTest.touch (   self,
  path 
)

Creates an empty file in the given path.

Member Data Documentation

◆ root_path

file_helper_test.FileHelperTest.root_path

home directory

◆ test_dir

file_helper_test.FileHelperTest.test_dir

current test directory

◆ test_dir1_oldb_file_1_path

file_helper_test.FileHelperTest.test_dir1_oldb_file_1_path

◆ test_dir1_oldb_path

file_helper_test.FileHelperTest.test_dir1_oldb_path

◆ test_dir1_path

file_helper_test.FileHelperTest.test_dir1_path

~/.file_helper_test/dir_1/oldb/file_1.yaml

◆ test_dir2_conf_file_2_path

file_helper_test.FileHelperTest.test_dir2_conf_file_2_path

◆ test_dir2_conf_path

file_helper_test.FileHelperTest.test_dir2_conf_path

◆ test_dir2_path

file_helper_test.FileHelperTest.test_dir2_path

~/.file_helper_test/dir_2/config/file_2.yaml

◆ test_dir3_conf_file_3_path

file_helper_test.FileHelperTest.test_dir3_conf_file_3_path

◆ test_dir3_conf_path

file_helper_test.FileHelperTest.test_dir3_conf_path

◆ test_dir3_path

file_helper_test.FileHelperTest.test_dir3_path

~/.file_helper_test/dir_3/config/file_3.yaml

◆ test_path

file_helper_test.FileHelperTest.test_path

The documentation for this class was generated from the following file: