@@ -56,6 +56,7 @@ def basic_offering(self, mock_acp_client, mock_contract_client):
5656 name = "Test Service" ,
5757 price = 10.0 ,
5858 price_type = PriceType .FIXED ,
59+ sla_minutes = 60 ,
5960 requirement = None ,
6061 deliverable = None
6162 )
@@ -71,6 +72,7 @@ def offering_with_schema(self, mock_acp_client, mock_contract_client):
7172 name = "Test Service" ,
7273 price = 10.0 ,
7374 price_type = PriceType .FIXED ,
75+ sla_minutes = 60 ,
7476 requirement = {
7577 "type" : "object" ,
7678 "properties" : {
@@ -96,6 +98,7 @@ def test_should_initialize_with_required_parameters(
9698 name = "Test Service" ,
9799 price = 10.0 ,
98100 price_type = PriceType .FIXED ,
101+ sla_minutes = 60 ,
99102 requirement = None ,
100103 deliverable = None
101104 )
@@ -123,6 +126,7 @@ def test_should_initialize_with_optional_parameters(
123126 name = "Test Service" ,
124127 price = 10.0 ,
125128 price_type = PriceType .PERCENTAGE ,
129+ sla_minutes = 60 ,
126130 requirement = requirement ,
127131 deliverable = deliverable ,
128132 )
@@ -145,6 +149,7 @@ def test_should_parse_valid_json_string(
145149 name = "Test Service" ,
146150 price = 10.0 ,
147151 price_type = PriceType .FIXED ,
152+ sla_minutes = 60 ,
148153 requirement = '{"type": "string"}' ,
149154 deliverable = None
150155 )
@@ -165,6 +170,7 @@ def test_should_keep_dict_requirement_as_is(
165170 name = "Test Service" ,
166171 price = 10.0 ,
167172 price_type = PriceType .FIXED ,
173+ sla_minutes = 60 ,
168174 requirement = requirement ,
169175 deliverable = None
170176 )
@@ -195,10 +201,10 @@ class TestInitiateJob:
195201 class TestExpiryHandling :
196202 """Test expiry date handling"""
197203
198- def test_should_use_default_expiry_when_none (
204+ def test_should_use_sla_minutes_for_expiry (
199205 self , basic_offering , mock_contract_client
200206 ):
201- """Should use default 1 day expiry when not provided """
207+ """Should use offering sla_minutes for job expiration """
202208 mock_contract_client .get_job_id .return_value = 123
203209 mock_contract_client .handle_operation .return_value = {}
204210 basic_offering .acp_client .get_by_client_and_provider .return_value = None
@@ -213,35 +219,12 @@ def test_should_use_default_expiry_when_none(
213219 service_requirement = {"task" : "test" }
214220 )
215221
216- # Check that create_job was called
217222 create_call = mock_contract_client .create_job .call_args
218223 expired_at = create_call [0 ][2 ] # Third positional arg
219224
220- # Should be 1 day after now
221- expected = mock_now + timedelta (days = 1 )
225+ expected = mock_now + timedelta (minutes = basic_offering .sla_minutes )
222226 assert expired_at == expected
223227
224- def test_should_use_custom_expiry_when_provided (
225- self , basic_offering , mock_contract_client
226- ):
227- """Should use custom expiry when provided"""
228- mock_contract_client .get_job_id .return_value = 123
229- mock_contract_client .handle_operation .return_value = {}
230- basic_offering .acp_client .get_by_client_and_provider .return_value = None
231-
232- custom_expiry = datetime (
233- 2024 , 12 , 31 , 23 , 59 , 59 , tzinfo = timezone .utc )
234-
235- basic_offering .initiate_job (
236- service_requirement = {"task" : "test" },
237- expired_at = custom_expiry
238- )
239-
240- create_call = mock_contract_client .create_job .call_args
241- expired_at = create_call [0 ][2 ]
242-
243- assert expired_at == custom_expiry
244-
245228 class TestServiceRequirementValidation :
246229 """Test service requirement validation"""
247230
0 commit comments