aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests/tools_api.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-04-04 18:18:21 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-04-04 18:18:23 -0700
commit5b4af5300ec58867d96affeb62e66032149cc0e7 (patch)
tree9e3feee4d615327ef1a782afff8dd163b1087477 /python/tests/tools_api.py
parent0240f792951444d6459e7621f43f0fc892599402 (diff)
downloadfatcat-5b4af5300ec58867d96affeb62e66032149cc0e7.tar.gz
fatcat-5b4af5300ec58867d96affeb62e66032149cc0e7.zip
test api helpers (found bug)
It seems that public_api() doesn't get isolated from authenticated_api(), even in different tests. I suspect this is due to using DefaultAPI to create client.
Diffstat (limited to 'python/tests/tools_api.py')
-rw-r--r--python/tests/tools_api.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/python/tests/tools_api.py b/python/tests/tools_api.py
new file mode 100644
index 00000000..ac75a73a
--- /dev/null
+++ b/python/tests/tools_api.py
@@ -0,0 +1,23 @@
+
+import pytest
+from fatcat_client import EditgroupAnnotation
+from fatcat_client.rest import ApiException
+
+from fatcat_tools import public_api, authenticated_api
+
+
+def test_authenticated_api():
+ api = authenticated_api("http://localhost:9411/v0")
+ api.get_changelog()
+ api.create_editgroup_annotation("aaaaaaaaaaaabo53aaaaaaaaa4",
+ EditgroupAnnotation(comment_markdown="bloop test thingie"))
+
+def test_public_api():
+ api = public_api("http://localhost:9411/v0")
+ api.get_changelog()
+ # XXX: there is some contamination happening here, and we're getting
+ # authenticated. Maybe the DefaultAPI thing?
+ pytest.skip("public_api() client not isolated from authenticated")
+ with pytest.raises(ApiException):
+ api.create_editgroup_annotation("aaaaaaaaaaaabo53aaaaaaaaa4",
+ EditgroupAnnotation(comment_markdown="bloop unauth test thingie"))