Skip to content

Commit

Permalink
added tests for new sections
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldg committed Oct 17, 2024
1 parent c0cca2a commit 9e35f14
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/unit/objectstore/irods_object_store_conf_logical_path.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<object_store type="irods">
<auth username="rods" password="rods" />
<resource name="demoResc" />
<zone name="tempZone" />
<connection host="localhost" port="1247" timeout="30" refresh_time="300" connection_pool_monitor_interval="3600"/>
<logical path="/tempZone/home/rods" />
<cache path="database/object_store_cache" size="1000" />
<extra_dir type="job_work" path="database/job_working_directory_irods"/>
<extra_dir type="temp" path="database/tmp_irods"/>
</object_store>
13 changes: 13 additions & 0 deletions test/unit/objectstore/irods_object_store_conf_ssl.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<object_store type="irods">
<auth username="rods" password="rods" />
<resource name="demoResc" />
<zone name="tempZone" />
<connection host="localhost" port="1247" timeout="30" refresh_time="300" connection_pool_monitor_interval="3600"/>
<ssl client_server_negotiation="request_server_negotiation" client_server_policy="CS_NEG_REQUIRE"
encryption_algorithm="AES-256-CBC" encryption_key_size="32" encryption_num_hash_rounds="16"
encryption_salt_size="8" ssl_verify_server="cert" ssl_ca_certificate_file="/etc/irods/ssl/irods.crt" />
<cache path="database/object_store_cache" size="1000" />
<extra_dir type="job_work" path="database/job_working_directory_irods"/>
<extra_dir type="temp" path="database/tmp_irods"/>
</object_store>
31 changes: 31 additions & 0 deletions test/unit/objectstore/test_irods.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
CONFIG_FILE_NAME_NO_AUTH = "irods_object_store_conf_no_auth.xml"
CONFIG_FILE_NO_AUTH = os.path.join(SCRIPT_DIRECTORY, CONFIG_FILE_NAME_NO_AUTH)

CONFIG_FILE_NAME_SSL = "irods_object_store_conf_ssl.xml"
CONFIG_FILE_SSL = os.path.join(SCRIPT_DIRECTORY, CONFIG_FILE_NAME_SSL)

CONFIG_FILE_NAME_LOGICAL_PATH = "irods_object_store_conf_logical_path.xml"
CONFIG_FILE_LOGICAL_PATH = os.path.join(SCRIPT_DIRECTORY, CONFIG_FILE_NAME_LOGICAL_PATH)


def test_parse_valid_config_xml():
tree = parse_xml(CONFIG_FILE)
Expand All @@ -39,6 +45,31 @@ def test_parse_valid_config_xml():
assert config["extra_dirs"][1]["path"] == "database/tmp_irods"


def test_parse_config_xml_ssl():
tree = parse_xml(CONFIG_FILE_SSL)
root = tree.getroot()
config = parse_config_xml(root)

print(config)

assert config["ssl"]["client_server_negotiation"] == "request_server_negotiation"
assert config["ssl"]["client_server_policy"] == "CS_NEG_REQUIRE"
assert config["ssl"]["encryption_algorithm"] == "AES-256-CBC"
assert config["ssl"]["encryption_key_size"] == 32
assert config["ssl"]["encryption_num_hash_rounds"] == 16
assert config["ssl"]["encryption_salt_size"] == 8
assert config["ssl"]["ssl_verify_server"] == "cert"
assert config["ssl"]["ssl_ca_certificate_file"] == "/etc/irods/ssl/irods.crt"


def test_parse_config_xml_logical_path():
tree = parse_xml(CONFIG_FILE_LOGICAL_PATH)
root = tree.getroot()
config = parse_config_xml(root)

assert config["logical"]["path"] == "/tempZone/home/rods"


def test_parse_config_xml_no_extra_dir():
tree = parse_xml(CONFIG_FILE_NO_EXTRA_DIR)
root = tree.getroot()
Expand Down

0 comments on commit 9e35f14

Please sign in to comment.