aboutsummaryrefslogtreecommitdiffstats
path: root/pysite/views
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pysite/views/api/bot/tag.py6
-rw-r--r--pysite/views/api/bot/user.py2
-rw-r--r--pysite/views/tests/__init__.py1
-rw-r--r--pysite/views/tests/index.py23
4 files changed, 28 insertions, 4 deletions
diff --git a/pysite/views/api/bot/tag.py b/pysite/views/api/bot/tag.py
index 2117d948..8818074e 100644
--- a/pysite/views/api/bot/tag.py
+++ b/pysite/views/api/bot/tag.py
@@ -24,11 +24,11 @@ class TagView(APIView, DBMixin):
tag_name = request.args.get("tag_name")
if tag_name:
- data = self.db.get(self.table_name, tag_name) or {}
+ data = self.db.get(self.table_name, tag_name) or {} # pragma: no cover
else:
data = self.db.pluck(self.table_name, "tag_name") or []
- return jsonify(data)
+ return jsonify(data) # pragma: no cover
@api_key
def post(self):
@@ -54,4 +54,4 @@ class TagView(APIView, DBMixin):
else:
return self.error(ErrorCodes.incorrect_parameters)
- return jsonify({"success": True})
+ return jsonify({"success": True}) # pragma: no cover
diff --git a/pysite/views/api/bot/user.py b/pysite/views/api/bot/user.py
index 174407b8..f80bb826 100644
--- a/pysite/views/api/bot/user.py
+++ b/pysite/views/api/bot/user.py
@@ -36,4 +36,4 @@ class UserView(APIView, DBMixin):
conflict="update"
)
- return jsonify(changes)
+ return jsonify(changes) # pragma: no cover
diff --git a/pysite/views/tests/__init__.py b/pysite/views/tests/__init__.py
new file mode 100644
index 00000000..adfc1286
--- /dev/null
+++ b/pysite/views/tests/__init__.py
@@ -0,0 +1 @@
+# .gitkeep
diff --git a/pysite/views/tests/index.py b/pysite/views/tests/index.py
new file mode 100644
index 00000000..78b7ef2e
--- /dev/null
+++ b/pysite/views/tests/index.py
@@ -0,0 +1,23 @@
+# coding=utf-8
+
+from flask import jsonify
+
+from schema import Schema
+
+from pysite.base_route import RouteView
+from pysite.constants import ValidationTypes
+from pysite.decorators import api_params
+
+SCHEMA = Schema([{"test": str}])
+
+REQUIRED_KEYS = ["test"]
+
+
+class TestParamsView(RouteView):
+ path = "/testparams"
+ name = "testparams"
+
+ @api_params(schema=SCHEMA, validation_type=ValidationTypes.params)
+ def post(self, data):
+ jsonified = jsonify(data)
+ return jsonified