Skip to content

Commit fc1821b

Browse files
committed
test fix
1 parent 4c898f0 commit fc1821b

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

seqerakit/helper.py

+3-9
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def parse_block(block_name, item):
169169
overwrite = item.pop("overwrite", None)
170170
on_exists_str = item.pop("on_exists", "fail")
171171

172-
# Convert string to enum
172+
# Convert string to enum if needed
173173
if isinstance(on_exists_str, str):
174174
on_exists_str = on_exists_str.upper()
175175
try:
@@ -189,14 +189,8 @@ def parse_block(block_name, item):
189189
# Call the appropriate function and return its result along with on_exists value.
190190
cmd_args = parse_fn(item)
191191

192-
# Return both on_exists and overwrite for backward compatibility
193-
result = {"cmd_args": cmd_args, "on_exists": on_exists.name.lower()}
194-
195-
# Set overwrite boolean for test compatibility
196-
# If on_exists is 'overwrite', set overwrite to True, otherwise False
197-
result["overwrite"] = on_exists == OnExists.OVERWRITE
198-
199-
return result
192+
# Return only the string value of on_exists for test compatibility
193+
return {"cmd_args": cmd_args, "on_exists": on_exists.name.lower()}
200194

201195

202196
# Parsers for certain blocks of yaml that require handling

seqerakit/overwrite.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
import json
1616
from seqerakit import utils
1717
from seqerakit.seqeraplatform import ResourceExistsError
18-
import logging
1918
from seqerakit.on_exists import OnExists
19+
import logging
2020

2121

2222
class Overwrite:
@@ -49,9 +49,10 @@ def __init__(self, sp):
4949
sp: A SeqeraPlatform class instance.
5050
5151
Attributes:
52-
sp: A SeqeraPlatform class instance.
53-
block_jsondata: A dictionary to cache JSON data for resources.
54-
block_operations: A dictionary mapping resource types to their operations.
52+
sp: A SeqeraPlatform class instance used to execute CLI commands.
53+
cached_jsondata: A cached placeholder for JSON data. Default value is None.
54+
block_jsondata: A dictionary to store JSON data for each block.
55+
Key is the block name, and value is the corresponding JSON data.
5556
"""
5657
self.sp = sp
5758
self.cached_jsondata = None
@@ -326,6 +327,7 @@ def _get_json_data(self, block, args, keys_to_get):
326327
with self.sp.suppress_output():
327328
self.cached_jsondata = json_method(block, "list")
328329

330+
self.block_jsondata[block] = self.cached_jsondata
329331
return self.cached_jsondata, sp_args
330332

331333
def check_resource_exists(self, name_key, sp_args):

0 commit comments

Comments
 (0)