Skip to content

Commit 128348e

Browse files
committed
Test (mock) publishing of specific step with input vars
1 parent b4bdb53 commit 128348e

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

tests/test_fairstep.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ def test_shacl_does_not_validate(self):
246246

247247
assert len(step.rdf) == n_triples_before, 'shacl_validate mutated RDF'
248248

249-
250-
def test_is_fairstep_decorator():
249+
@patch('fairworkflows.rdf_wrapper.NanopubClient.publish')
250+
def test_is_fairstep_decorator(mock_publish):
251251
@is_fairstep(label='test_label')
252252
def add(a: int, b: int) -> int:
253253
"""
@@ -257,6 +257,9 @@ def add(a: int, b: int) -> int:
257257

258258
assert hasattr(add(1,2), '_fairstep')
259259

260+
add._fairstep.publish_as_nanopub()
261+
assert mock_publish.call_count == 1
262+
260263
def test_decorator_semantic_types():
261264
test_types_a = ['http://www.example.org/distance', 'http://www.example.org/number']
262265
test_type_output = 'http://www.example.org/walrus'

0 commit comments

Comments
 (0)