File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change
1
+ import json
2
+
1
3
import httpx
2
4
import pytest
3
5
import respx
14
16
201 ,
15
17
json = {
16
18
"id" : "p1" ,
19
+ "model" : "test/model" ,
17
20
"version" : "v1" ,
18
21
"urls" : {
19
22
"get" : "https://api.replicate.com/v1/predictions/p1" ,
@@ -46,6 +49,7 @@ async def test_deployment_predictions_create(async_flag):
46
49
input = {"text" : "world" },
47
50
webhook = "https://example.com/webhook" ,
48
51
webhook_events_filter = ["completed" ],
52
+ stream = True ,
49
53
)
50
54
else :
51
55
deployment = client .deployments .get ("test/model" )
@@ -54,8 +58,16 @@ async def test_deployment_predictions_create(async_flag):
54
58
input = {"text" : "world" },
55
59
webhook = "https://example.com/webhook" ,
56
60
webhook_events_filter = ["completed" ],
61
+ stream = True ,
57
62
)
58
63
59
64
assert router ["deployments.predictions.create" ].called
65
+ request = router ["deployments.predictions.create" ].calls [0 ].request
66
+ request_body = json .loads (request .content )
67
+ assert request_body ["input" ] == {"text" : "world" }
68
+ assert request_body ["webhook" ] == "https://example.com/webhook"
69
+ assert request_body ["webhook_events_filter" ] == ["completed" ]
70
+ assert request_body ["stream" ] is True
71
+
60
72
assert prediction .id == "p1"
61
73
assert prediction .input == {"text" : "world" }
You can’t perform that action at this time.
0 commit comments