Skip to content

Commit 8c06346

Browse files
authored
fix: adding binary to web.put (#250)
* fix: adding binary to web.put * adding tests
1 parent 4003e4c commit 8c06346

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

tests/test_web_put_req.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,18 @@ def test_invalid_async_type(schema):
146146
jsonschema.validate(instance=instance, schema=schema)
147147
assert "is not of type 'boolean'" in str(excinfo.value)
148148

149+
def test_valid_with_binary(schema):
150+
"""Tests valid request with binary flag."""
151+
instance = {"req": "web.put", "route": "SensorService", "binary": True}
152+
jsonschema.validate(instance=instance, schema=schema)
153+
154+
def test_invalid_binary_type(schema):
155+
"""Tests invalid type for binary."""
156+
instance = {"req": "web.put", "route": "SensorService", "binary": "true"}
157+
with pytest.raises(jsonschema.ValidationError) as excinfo:
158+
jsonschema.validate(instance=instance, schema=schema)
159+
assert "is not of type 'boolean'" in str(excinfo.value)
160+
149161
def test_valid_with_file_and_note(schema):
150162
"""Tests valid request with file and note parameters."""
151163
instance = {"req": "web.put", "route": "SensorService", "file": "response.dbx", "note": "response1"}

web.put.req.notecard.api.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
"type": "boolean",
1818
"minApiVersion": "5.1.1"
1919
},
20+
"binary": {
21+
"description": "If `true`, the Notecard will send all the data in the binary buffer to the specified proxy route in Notehub.\n\nLearn more in this guide on [Sending and Receiving Large Binary Objects](https://dev.blues.io/guides-and-tutorials/notecard-guides/sending-and-receiving-large-binary-objects/).",
22+
"type": "boolean",
23+
"minApiVersion": "5.3.1"
24+
},
2025
"body": {
2126
"description": "The JSON body to send with the request.",
2227
"type": "object"

0 commit comments

Comments
 (0)