]> git.lizzy.rs Git - cheatdb.git/blobdiff - app/tests/utils.py
Add delete unused uploads admin function
[cheatdb.git] / app / tests / utils.py
index 782bb1de62e706421e6fde7d5e2f8ed6df390c6d..be2b8690fa708725276dc13e0a37d0dd9c9f3c8d 100644 (file)
@@ -1,4 +1,4 @@
-import pytest
+import pytest, json
 from app import app
 from app.models import db, User
 from app.default_data import populate
@@ -16,6 +16,21 @@ def recreate_db():
        populate(db.session)
        db.session.commit()
 
+def parse_json(b):
+       return json.loads(b.decode("utf8"))
+
+def is_type(t, v):
+       return v and isinstance(v, t)
+
+def is_optional(t, v):
+       return not v or isinstance(v, t)
+
+def is_str(v):
+       return is_type(str, v)
+
+def is_int(v):
+       return is_type(int, v)
+
 
 @pytest.fixture
 def client():