summaryrefslogtreecommitdiffstats
path: root/python/tests/api_annotations.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-01-15 19:13:22 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-01-15 19:13:22 -0800
commiteea40c6c713a35e19eb005a322b2075018a32e3e (patch)
treef20e724e91036846e7d0902871377eb2067e5500 /python/tests/api_annotations.py
parentd6b7aced6fb8841ab986fe02e0bc752d821f4ee2 (diff)
downloadfatcat-eea40c6c713a35e19eb005a322b2075018a32e3e.tar.gz
fatcat-eea40c6c713a35e19eb005a322b2075018a32e3e.zip
add annotations and editgroup tests
Diffstat (limited to 'python/tests/api_annotations.py')
-rw-r--r--python/tests/api_annotations.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/python/tests/api_annotations.py b/python/tests/api_annotations.py
new file mode 100644
index 00000000..0d3c5046
--- /dev/null
+++ b/python/tests/api_annotations.py
@@ -0,0 +1,39 @@
+
+import json
+import pytest
+from copy import copy
+
+from fatcat_client import *
+from fatcat_client.rest import ApiException
+from fixtures import *
+
+
+def test_annotations(api):
+
+ eg = quick_eg(api)
+
+ # ensure no annotations on this object
+ a = api.get_editgroup_annotations(eg.editgroup_id)
+ assert a == []
+
+ # create an annotation!
+ api.create_editgroup_annotation(
+ eg.editgroup_id,
+ EditgroupAnnotation(
+ comment_markdown="some *annotation*",
+ extra=dict(thing="thang")))
+
+ # check that we can fetch it all sorts of ways
+ a = api.get_editgroup_annotations(eg.editgroup_id)
+ assert len(a) == 1
+ assert a[0].extra['thing'] == "thang"
+
+ # the editor persists, so this is a hack to find a "recent" one
+ a2 = api.get_editor_annotations(eg.editor_id, limit=100)
+ found = None
+ for thing in a2:
+ if thing.annotation_id == a[0].annotation_id:
+ found = thing
+ break
+ assert thing
+ assert thing.extra['thing'] == "thang"