-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: unit testing code -- make sure to add Vector3 for mesh position!
- Loading branch information
Showing
2 changed files
with
30 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import oursin as urchin | ||
import pytest | ||
import jsonschema | ||
import json | ||
import requests | ||
|
||
from unittest.mock import patch | ||
|
||
vector3data_url = "https://raw.githubusercontent.com/VirtualBrainLab/vbl-json-schema/pydantic/src/vbl_json_schema/schemas/vector3.json" | ||
response = requests.get(vector3data_url) | ||
vector3data_schema = json.loads(response.text) | ||
|
||
def test_mesh(): | ||
with patch.object(urchin.client.sio, 'emit') as mock_emit: | ||
mesh = urchin.meshes.Mesh() | ||
|
||
mesh.set_scale([1,1,1]) | ||
|
||
call = mock_emit.call_args | ||
|
||
msg = call.args[0] | ||
data = call.args[1] | ||
print(data) | ||
|
||
try: | ||
jsonschema.validate(data, vector3data_schema) | ||
except jsonschema.exceptions.ValidationError as e: | ||
pytest.fail() |