aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/db/rdf
diff options
context:
space:
mode:
authorMunyoki Kilyungi2024-09-10 10:32:51 +0300
committerBonfaceKilz2024-09-11 10:30:57 +0300
commitbceb5ce98c14dc64ef3980caf23f975278f63d50 (patch)
tree2034ddeef19fdab908e8f4c2e8cb579d821f594b /tests/unit/db/rdf
parent90458985115a0cc1234c7e39436d6ee50838b136 (diff)
downloadgenenetwork3-bceb5ce98c14dc64ef3980caf23f975278f63d50.tar.gz
Add test cases for wiki.__sanitize_result.
* tests/unit/db/rdf/test_wiki.py (test_sanitize_result): New file. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'tests/unit/db/rdf')
-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