Пример #1
0
 def testDeleteCollectionRemote(self):
     # drive RESTful API via wrapper
     tca = TreeCollectionsAPI(self.domains, get_from='api')
     # remove any prior clones of our tests collection? or let them pile up for now?
     cl = tca.collection_list
     cid = 'jimallman/doomed-collection'
     if cid not in cl:
         # add our dummy collection so just we can delete it
         cjson = get_empty_collection()
         commit_msg = 'Creating temporary collection via API wrapper'
         result = tca.post_collection(cjson,
                                      cid,
                                      commit_msg)
         cl = tca.collection_list
         self.assertEqual(result['error'], 0)
         self.assertEqual(result['merge_needed'], False)
         self.assertEqual(result['resource_id'], cid)
         self.assertTrue(cid in cl)
     # now try to clobber it
     try:
         c = tca.get_collection(cid)
     except HTTPError as err:
         raise_http_error_with_more_detail(err)
     except Exception as err:
         raise err
     else:
         tca.delete_collection(cid, c['sha'])
         # is it really gone?
         cl = tca.collection_list
         self.assertTrue(cid not in cl)
Пример #2
0
 def testDeleteCollectionRemote(self):
     # drive RESTful API via wrapper
     tca = TreeCollectionsAPI(self.domains, get_from='api')
     # remove any prior clones of our tests collection? or let them pile up for now?
     cl = tca.collection_list
     cid = 'jimallman/doomed-collection'
     if cid not in cl:
         # add our dummy collection so just we can delete it
         cjson = get_empty_collection()
         commit_msg = 'Creating temporary collection via API wrapper'
         result = tca.post_collection(cjson, cid, commit_msg)
         cl = tca.collection_list
         self.assertEqual(result['error'], 0)
         self.assertEqual(result['merge_needed'], False)
         self.assertEqual(result['resource_id'], cid)
         self.assertTrue(cid in cl)
     # now try to clobber it
     try:
         c = tca.get_collection(cid)
     except HTTPError as err:
         raise_http_error_with_more_detail(err)
     except Exception as err:
         raise err
     else:
         tca.delete_collection(cid, c['sha'])
         # is it really gone?
         cl = tca.collection_list
         self.assertTrue(cid not in cl)
Пример #3
0
 def testRemoteSugar(self):
     tca = TreeCollectionsAPI(self.domains, get_from='api')
     try:
         test_collections_api(self, tca)
     except HTTPError as err:
         raise_http_error_with_more_detail(err)
     except Exception as err:
         raise err
Пример #4
0
 def testRemoteSugar(self):
     tca = TreeCollectionsAPI(self.domains, get_from='api')
     try:
         test_collections_api(self, tca)
     except HTTPError as err:
         raise_http_error_with_more_detail(err)
     except Exception as err:
         raise err
Пример #5
0
 def testRemoteSugar(self):
     taa = TaxonomicAmendmentsAPI(self.domains, get_from='api')
     try:
         test_amendments_api(self, taa)
     except HTTPError as err:
         raise_http_error_with_more_detail(err)
     except Exception as err:
         raise err
Пример #6
0
 def testRemoteSugar(self):
     taa = TaxonomicAmendmentsAPI(self.domains, get_from="api")
     try:
         test_amendments_api(self, taa)
     except HTTPError as err:
         raise_http_error_with_more_detail(err)
     except Exception as err:
         raise err
Пример #7
0
 def testFetchCollectionRemote(self):
     # drive RESTful API via wrapper
     tca = TreeCollectionsAPI(self.domains, get_from='api')
     try:
         c = tca.get_collection('jimallman/my-test-collection')
     except HTTPError as err:
         raise_http_error_with_more_detail(err)
     except Exception as err:
         raise err
     else:
         # N.B. we get the JSON "wrapper" with history, etc.
         cn = c['data']['name']
         self.assertTrue(cn == u'My test collection')
Пример #8
0
 def testFetchCollectionRemote(self):
     # drive RESTful API via wrapper
     tca = TreeCollectionsAPI(self.domains, get_from='api')
     try:
         c = tca.get_collection('jimallman/my-test-collection')
     except HTTPError as err:
         raise_http_error_with_more_detail(err)
     except Exception as err:
         raise err
     else:
         # N.B. we get the JSON "wrapper" with history, etc.
         cn = c['data']['name']
         self.assertTrue(cn == u'My test collection')