Skip to content

Commit 39ae141

Browse files
committed
test: add basic sad path unit tests for ParametersConstructor
1 parent fe4dc3b commit 39ae141

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""Sad path tests for SPARQLOperationParametersConstructor."""
2+
3+
import pytest
4+
from sparqlx.utils.operation_parameters import (
5+
QueryOperationParametersConstructor,
6+
UpdateOperationParametersConstructor,
7+
)
8+
9+
10+
def test_query_operation_parameters_invalid_method():
11+
msg = "Expected query method 'GET', 'POST' or 'POST-direct'. Got 'invalid'."
12+
with pytest.raises(ValueError, match=msg):
13+
QueryOperationParametersConstructor(
14+
query="select * where {}", query_type="SelectQuery"
15+
).get_params("invalid") # type: ignore
16+
17+
18+
def test_update_operation_parameters_invalid_method():
19+
msg = "Expected update method 'POST' or 'POST-direct'. Got 'invalid'."
20+
with pytest.raises(ValueError, match=msg):
21+
UpdateOperationParametersConstructor(
22+
update_request="insert {} where {}"
23+
).get_params("invalid") # type: ignore

0 commit comments

Comments
 (0)