aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/db/rdf/__init__.py0
-rw-r--r--tests/unit/db/rdf/test_wiki.py157
2 files changed, 157 insertions, 0 deletions
diff --git a/tests/unit/db/rdf/__init__.py b/tests/unit/db/rdf/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/unit/db/rdf/__init__.py
diff --git a/tests/unit/db/rdf/test_wiki.py b/tests/unit/db/rdf/test_wiki.py
new file mode 100644
index 0000000..e8f0e62
--- /dev/null
+++ b/tests/unit/db/rdf/test_wiki.py
@@ -0,0 +1,157 @@
+"""Tests for gn3/db/rdf/wiki.py"""
+
+import pytest
+
+from gn3.db.rdf.wiki import __sanitize_result
+
+
+@pytest.mark.unit_test
+@pytest.mark.parametrize(
+ ("result", "expected"),
+ (
+ (
+ {
+ "categories": "",
+ "comment": "comment",
+ "created": "2006-12-23 17:19:14",
+ "email": "XXX@XXX.edu",
+ "initial": "KMz",
+ "pubmed_ids": "",
+ "reason": "add",
+ "species": "mouse",
+ "symbol": "Sfrs3",
+ "version": 0,
+ "web_url": "",
+ },
+ {
+ "categories": [],
+ "comment": "comment",
+ "created": "2006-12-23 17:19:14",
+ "email": "XXX@XXX.edu",
+ "initial": "KMz",
+ "pubmed_ids": [],
+ "reason": "add",
+ "species": "mouse",
+ "symbol": "Sfrs3",
+ "version": 0,
+ "web_url": "",
+ },
+ ),
+ (
+ {
+ "categories": "some-category",
+ "comment": "comment",
+ "created": "2006-12-23 17:19:14",
+ "email": "XXX@XXX.edu",
+ "initial": "KMz",
+ "pubmed_ids": "",
+ "reason": "add",
+ "species": "mouse",
+ "symbol": "Sfrs3",
+ "version": 0,
+ "web_url": "",
+ },
+ {
+ "categories": ["some-category"],
+ "comment": "comment",
+ "created": "2006-12-23 17:19:14",
+ "email": "XXX@XXX.edu",
+ "initial": "KMz",
+ "pubmed_ids": [],
+ "reason": "add",
+ "species": "mouse",
+ "symbol": "Sfrs3",
+ "version": 0,
+ "web_url": "",
+ },
+ ),
+ (
+ {
+ "categories": "",
+ "comment": "comment",
+ "created": "2006-12-23 17:19:14",
+ "email": "XXX@XXX.edu",
+ "initial": "KMz",
+ "pubmed_ids": "21",
+ "reason": "add",
+ "species": "mouse",
+ "symbol": "Sfrs3",
+ "version": 0,
+ "web_url": "",
+ },
+ {
+ "categories": [],
+ "comment": "comment",
+ "created": "2006-12-23 17:19:14",
+ "email": "XXX@XXX.edu",
+ "initial": "KMz",
+ "pubmed_ids": [21],
+ "reason": "add",
+ "species": "mouse",
+ "symbol": "Sfrs3",
+ "version": 0,
+ "web_url": "",
+ },
+ ),
+ (
+ {
+ "categories": "",
+ "comment": "comment",
+ "created": "2006-12-23 17:19:14",
+ "email": "XXX@XXX.edu",
+ "initial": "KMz",
+ "pubmed_ids": 21,
+ "reason": "add",
+ "species": "mouse",
+ "symbol": "Sfrs3",
+ "version": 0,
+ "web_url": "",
+ },
+ {
+ "categories": [],
+ "comment": "comment",
+ "created": "2006-12-23 17:19:14",
+ "email": "XXX@XXX.edu",
+ "initial": "KMz",
+ "pubmed_ids": [21],
+ "reason": "add",
+ "species": "mouse",
+ "symbol": "Sfrs3",
+ "version": 0,
+ "web_url": "",
+ },
+ ),
+ (
+ {
+ "categories": "",
+ "comment": "comment",
+ "created": "2006-12-23 17:19:14",
+ "email": "XXX@XXX.edu",
+ "initial": "KMz",
+ "pubmed_ids": [21, 22],
+ "reason": "add",
+ "species": "mouse",
+ "symbol": "Sfrs3",
+ "version": 0,
+ "web_url": "",
+ },
+ {
+ "categories": [],
+ "comment": "comment",
+ "created": "2006-12-23 17:19:14",
+ "email": "XXX@XXX.edu",
+ "initial": "KMz",
+ "pubmed_ids": [21, 22],
+ "reason": "add",
+ "species": "mouse",
+ "symbol": "Sfrs3",
+ "version": 0,
+ "web_url": "",
+ },
+ ),
+ ({}, {}),
+ ),
+)
+def test_sanitize_result(result, expected):
+ """Test that the JSON-LD result is sanitized correctly"""
+ assert __sanitize_result(result) == expected