Skip to content

Commit 0ba1bb8

Browse files
committed
Add basic tests for SIMContext
1 parent 4abaeaf commit 0ba1bb8

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

tests/client/contexts/test_sim.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
from pathlib import Path
2+
3+
from murfey.client.contexts.sim import SIMContext
4+
5+
6+
def test_sim_context_initialises(tmp_path: Path):
7+
# Initialise the context with dummy variables
8+
base_path = tmp_path
9+
machine_config = {"dummy": "dummy"}
10+
context = SIMContext(
11+
"sim",
12+
basepath=base_path,
13+
machine_config=machine_config,
14+
token="dummy",
15+
)
16+
17+
assert context._basepath == base_path
18+
assert context._machine_config == machine_config
19+
assert context._token == "dummy"
20+
assert context.name == "SIMContext"
21+
22+
23+
def test_post_transfer(
24+
tmp_path: Path,
25+
):
26+
"""
27+
NOTE: This is just a basic test for coverage purposes, and will be rewritten
28+
as the SIMContext logic evolves and matures.
29+
"""
30+
# Create a dummy file
31+
base_path = tmp_path
32+
visit_dir = base_path / "visit"
33+
test_file = visit_dir / "raw" / "dummy.txt"
34+
test_file.parent.mkdir(parents=True, exist_ok=True)
35+
test_file.touch(exist_ok=True)
36+
37+
# Create other mock variables
38+
machine_config = {"dummy": "dummy"}
39+
40+
context = SIMContext(
41+
"sim",
42+
basepath=base_path,
43+
machine_config=machine_config,
44+
token="dummy",
45+
)
46+
assert (
47+
context.post_transfer(
48+
transferred_file=test_file,
49+
environment=None,
50+
)
51+
is None
52+
)

0 commit comments

Comments
 (0)