From 1fa8f820fd3b7c64d424f55796d2b860d22e4b22 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 23 Jan 2019 14:35:16 -0800 Subject: specific test for desc/extra in editgroups --- python/tests/api_editgroups.py | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/python/tests/api_editgroups.py b/python/tests/api_editgroups.py index cff3ffaf..722d8686 100644 --- a/python/tests/api_editgroups.py +++ b/python/tests/api_editgroups.py @@ -111,6 +111,30 @@ def test_editgroup_autoaccept(api): assert eg2.changelog_index #print(edits1) #print(eg1.edits.creators) - assert eg1.edits.creators[0].ident == edits1[0].ident - assert eg2.edits.creators[0].ident == edits2[0].ident + assert eg1.edits.creators[0].ident in [t.ident for t in edits1] + assert eg2.edits.creators[0].ident in [t.ident for t in edits2] + +def test_batch_params(api): + + eg = quick_eg(api) + c1 = CreatorEntity(display_name="test autoaccept") + c2 = CreatorEntity(display_name="test another autoaccept") + + with pytest.raises(fatcat_client.rest.ApiException): + edits = api.create_creator_batch([c1, c2]) + + desc = "test description" + extra = dict(a=75, q="thing") + edits = api.create_creator_batch([c1, c2], autoaccept=True, description=desc, extra=json.dumps(extra)) + eg = api.get_editgroup(edits[0].editgroup_id) + + assert eg.description == desc + assert eg.extra == extra + + # currently must manually json dumps() extra field + with pytest.raises(fatcat_client.rest.ApiException): + api.create_creator_batch([c1, c2], autoaccept=True, description=desc, extra=extra) + + with pytest.raises(fatcat_client.rest.ApiException): + api.create_creator_batch([c1, c2], autoaccept=True, description=desc, extra="{") -- cgit v1.2.3