Skip to content

Feat/unit tests #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7fe2621
Merge pull request #10 from Geode-solutions/next
JulienChampagnol Jan 2, 2024
ac2abe3
schemas
JulienChampagnol Feb 2, 2024
31a0265
rename vtkw_server.py
JulienChampagnol Feb 2, 2024
aecdf1e
import schemas
JulienChampagnol Feb 2, 2024
bd661a8
unit tests
JulienChampagnol Feb 2, 2024
bd78c83
tests
JulienChampagnol Feb 5, 2024
11291b8
feat(unit tests): run server
JulienChampagnol Feb 6, 2024
f599345
class tests
JulienChampagnol Feb 7, 2024
5bb82c0
save create_object_pipeline fail
JulienChampagnol Feb 8, 2024
a3c104a
ENV variables
JulienChampagnol Feb 9, 2024
6013ae8
clean config
JulienChampagnol Feb 12, 2024
75c1ed4
fix some tests
JulienChampagnol Feb 12, 2024
99751e6
test_delete_object_pipeline
JulienChampagnol Feb 13, 2024
dcf7d15
os.mkdir(DATA_FOLDER_PATH)
JulienChampagnol Feb 14, 2024
b4fd9a7
dotenv
JulienChampagnol Feb 14, 2024
a40af27
dynamic args
JulienChampagnol Feb 21, 2024
6bacedb
route becomes rpc
JulienChampagnol Feb 27, 2024
c01871b
test
JulienChampagnol Feb 27, 2024
1f62048
schemas
JulienChampagnol Feb 27, 2024
954d2c5
remove print
JulienChampagnol Feb 27, 2024
4da951a
fix schemas
JulienChampagnol Feb 27, 2024
f6e3414
move json imports
JulienChampagnol Feb 29, 2024
8d8a8d5
log
JulienChampagnol Feb 29, 2024
7268b09
tests
JulienChampagnol Feb 29, 2024
b980258
delete
JulienChampagnol Feb 29, 2024
07e9ed7
test_apply_textures working
JulienChampagnol Mar 4, 2024
b704167
Add datas
JulienChampagnol Mar 4, 2024
c244ca4
test_get_point_position
JulienChampagnol Mar 4, 2024
0e6316d
full from next
JulienChampagnol Mar 5, 2024
41e5ac1
cleanup
JulienChampagnol Mar 5, 2024
ddb87c6
delete penguin
JulienChampagnol Mar 5, 2024
212930c
remove unused datas
JulienChampagnol Mar 6, 2024
b2bbc8c
fix protocols self.render()
JulienChampagnol Mar 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ env/
venv/
.vscode/
__pycache__/
.env
data/
/node_modules
schemas.json
latest_logs
schemas.json
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
"files": [
"schemas.json"
]
}
}
31 changes: 31 additions & 0 deletions src/opengeodeweb_viewer/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import os
from sys import platform


def default_config():
os.environ["HOST"] = "0.0.0.0"
os.environ["PORT"] = "1234"


def prod_config():
default_config()
os.environ["DATA_FOLDER_PATH"] = "/data/"


def dev_config():
default_config()
if platform == "linux":
os.environ["DATA_FOLDER_PATH"] = "/temp/OpenGeodeWeb_Data/"
elif platform == "win32":
os.environ["DATA_FOLDER_PATH"] = os.path.join(
"C:/Users", os.getlogin(), "OpenGeodeWeb_Data"
)
if not os.path.exists(os.environ.get("DATA_FOLDER_PATH")):
os.mkdir(os.environ.get("DATA_FOLDER_PATH"))


def test_config():
default_config()
os.environ["DATA_FOLDER_PATH"] = os.path.join(
os.path.dirname(__file__), "..", "..", "tests", "data"
)
10 changes: 9 additions & 1 deletion src/opengeodeweb_viewer/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@ def validate_schemas(params, schema):
try:
validate(instance=params, schema=schema)
except ValidationError as e:
print(400, f"Validation error: {e.message}")
print(f"Validation error: {e.message}", flush=True)
raise Exception(
{
"code": 400,
"route": schema["rpc"],
"name": "Bad request",
"description": e.message,
}
)
21 changes: 14 additions & 7 deletions src/opengeodeweb_viewer/rpc/schemas/apply_textures.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"rpc": "toggle_object_visibility",
"rpc": "apply_textures",
"type": "object",
"properties": {
"id": {
Expand All @@ -8,14 +8,21 @@
"textures": {
"type": "array",
"elements": {
"type": "string"
"type": "object",
"properties": {
"texture_name": {
"type": "string"
},
"texture_file_name": {
"type": "string"
}
},
"required": ["texture_name", "texture_file_name"],
"additionalProperties": false
},
"minItems": 1
}
},
"required": [
"id",
"textures"
],
"required": ["id", "textures"],
"additionalProperties": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
"type": "string"
}
},
"required": [
"id",
"file_name"
],
"required": ["id", "file_name"],
"additionalProperties": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"properties": {},
"required": [],
"additionalProperties": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
"type": "string"
}
},
"required": [
"id"
],
"required": ["id"],
"additionalProperties": false
}
}
11 changes: 4 additions & 7 deletions src/opengeodeweb_viewer/rpc/schemas/get_point_position.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
"type": "object",
"properties": {
"x": {
"type": "int16"
"type": "integer"
},
"y": {
"type": "int16"
"type": "integer"
}
},
"required": [
"x",
"y"
],
"required": ["x", "y"],
"additionalProperties": false
}
}
9 changes: 3 additions & 6 deletions src/opengeodeweb_viewer/rpc/schemas/point_size.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@
"type": "string"
},
"size": {
"type": "float64"
"type": "number"
}
},
"required": [
"id",
"size"
],
"required": ["id", "size"],
"additionalProperties": false
}
}
2 changes: 1 addition & 1 deletion src/opengeodeweb_viewer/rpc/schemas/reset_camera.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"properties": {},
"required": [],
"additionalProperties": false
}
}
21 changes: 11 additions & 10 deletions src/opengeodeweb_viewer/rpc/schemas/set_color.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@
"type": "string"
},
"red": {
"type": "uint8"
"type": "integer",
"minimum": 0,
"maximum": 255
},
"green": {
"type": "uint8"
"type": "integer",
"minimum": 0,
"maximum": 255
},
"blue": {
"type": "uint8"
"type": "integer",
"minimum": 0,
"maximum": 255
}
},
"required": [
"id",
"red",
"green",
"blue"
],
"required": ["id", "red", "green", "blue"],
"additionalProperties": false
}
}
7 changes: 2 additions & 5 deletions src/opengeodeweb_viewer/rpc/schemas/set_vertex_attribute.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
"type": "string"
}
},
"required": [
"id",
"name"
],
"required": ["id", "name"],
"additionalProperties": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
"type": "boolean"
}
},
"required": [
"id",
"visibility"
],
"required": ["id", "visibility"],
"additionalProperties": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
"type": "boolean"
}
},
"required": [
"id",
"is_visible"
],
"required": ["id", "is_visible"],
"additionalProperties": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
"type": "boolean"
}
},
"required": [
"id",
"visibility"
],
"required": ["id", "visibility"],
"additionalProperties": false
}
}
6 changes: 2 additions & 4 deletions src/opengeodeweb_viewer/rpc/schemas/update_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
"type": "string"
}
},
"required": [
"id"
],
"required": ["id"],
"additionalProperties": false
}
}
Loading