Skip to content

Commit

Permalink
tests added
Browse files Browse the repository at this point in the history
  • Loading branch information
khsrali committed Aug 20, 2024
1 parent 7331bc2 commit ff9b65e
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion tests/test_computer.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ def test_validate_temp_directory(
).exists()


def test_dynamic_info(firecrest_config, monkeypatch, tmpdir: Path):
def test_dynamic_info_direct_size(firecrest_config, monkeypatch, tmpdir: Path):
from aiida_firecrest.transport import _dynamic_info_direct_size

assert monkeypatch is not None
monkeypatch.setattr("click.echo", lambda x: None)
ctx = Mock()
ctx.params = {
Expand All @@ -130,3 +131,28 @@ def test_dynamic_info(firecrest_config, monkeypatch, tmpdir: Path):
# note: user cannot enter negative numbers anyways, click raise as this shoule be float not str
result = _dynamic_info_direct_size(ctx, None, 10)
assert result == 10


def test_dynamic_info_firecrest_version(firecrest_config, monkeypatch, tmpdir: Path):

from aiida_firecrest.transport import _dynamic_info_firecrest_version

monkeypatch.setattr("click.echo", lambda x: None)
ctx = Mock()
ctx.params = {
"url": f"{firecrest_config.url}",
"token_uri": f"{firecrest_config.token_uri}",
"client_id": f"{firecrest_config.client_id}",
"client_secret": f"{firecrest_config.client_secret}",
"compute_resource": f"{firecrest_config.compute_resource}",
"temp_directory": f"{firecrest_config.temp_directory}",
"api_version": f"{firecrest_config.api_version}",
}

# should catch FIRECREST_VERSION if value is not provided
result = _dynamic_info_firecrest_version(ctx, None, "0")
assert isinstance(result, str)

# should use the value if provided
result = _dynamic_info_firecrest_version(ctx, None, "10.10.10")
assert result == "10.10.10"

0 comments on commit ff9b65e

Please sign in to comment.