diff --git a/tests/test_labthing.py b/tests/test_labthing.py index 043a28e1..4a45467f 100644 --- a/tests/test_labthing.py +++ b/tests/test_labthing.py @@ -240,3 +240,24 @@ def test_version(thing): thing.version = "x.x.x" assert thing.version == "x.x.x" assert thing.spec.version == "x.x.x" + + +def test_build_property(thing): + obj = type("obj", (object,), {"property_name": "propertyValue"}) + + thing.build_property(obj, "property_name") + # -1 index for last view added + # 1 index for URL tuple + assert "/properties/type/property_name" in thing.views[-1][1] + + +def test_build_action(thing): + def f(): + return "response" + + obj = type("obj", (object,), {"f": f}) + + thing.build_action(obj, "f") + # -1 index for last view added + # 1 index for URL tuple + assert "/actions/type/f" in thing.views[-1][1] diff --git a/tests/test_views_builder.py b/tests/test_views_builder.py index 6e40c154..013de4ef 100644 --- a/tests/test_views_builder.py +++ b/tests/test_views_builder.py @@ -9,7 +9,6 @@ def test_property_of_no_schema(app, client): obj = type("obj", (object,), {"property_name": "propertyValue"}) - # GeneratedClass = builder.property_of(obj, "property_name", schema=fields.String()) GeneratedClass = builder.property_of(obj, "property_name", schema=fields.String()) app.add_url_rule("/", view_func=GeneratedClass.as_view("index")) @@ -22,7 +21,6 @@ def test_property_of_no_schema(app, client): def test_property_of_with_schema(app, client): obj = type("obj", (object,), {"property_name": "propertyValue"}) - # GeneratedClass = builder.property_of(obj, "property_name", schema=fields.String()) GeneratedClass = builder.property_of(obj, "property_name", schema=fields.String()) app.add_url_rule("/", view_func=GeneratedClass.as_view("index"))