def get_revisions(self, fid=None, **kwargs): return self.app.get(self.project.api_url_for( 'osfstorage_get_revisions', fid=fid or self.record._id, **signing.sign_data(signing.default_signer, {})), auth=self.user.auth, **kwargs)
def send_hook(self, view_name, payload, method='get', **kwargs): method = getattr(self.app, method) return method( self.project.api_url_for(view_name), signing.sign_data(signing.default_signer, payload), **kwargs )
def send_hook(self, view_name, view_kwargs, payload, target, method='get', **kwargs): method = getattr(self.app, method) guid = view_kwargs.pop('guid', None) or target._id return method( api_url_for(view_name, guid=guid, **view_kwargs), signing.sign_data(signing.default_signer, payload), **kwargs )
def send_hook(self, view_name, payload, method='get', **kwargs): method = getattr(self.app, method) return method( '{url}?payload={payload}&signature={signature}'.format( url=self.project.api_url_for(view_name), **signing.sign_data(signing.default_signer, payload) ), **kwargs )
def func(name, *args, **kwargs): osfstorage = quickfiles.get_addon('osfstorage') root = osfstorage.get_root() url = '/api/v1/{}/osfstorage/{}/children/'.format(quickfiles._id, root._id) expect_errors = kwargs.pop('expect_errors', False) payload = make_payload(user=user, name=name, **kwargs) res = flask_app.post_json(url, signing.sign_data(signing.default_signer, payload), expect_errors=expect_errors) return res
def send_hook(self, view_name, view_kwargs, payload, target, method='get', **kwargs): method = getattr(self.app, method) return method( '{url}?payload={payload}&signature={signature}'.format( url=api_url_for(view_name, guid=target._id, **view_kwargs), **signing.sign_data(signing.default_signer, payload) ), **kwargs )
def get_revisions(self, path=None, page=None, **kwargs): return self.app.get(self.project.api_url_for( 'osf_storage_get_revisions', **signing.sign_data(signing.default_signer, { 'path': path or self.path, 'page': page, })), auth=self.user.auth, **kwargs)
def get_revisions(self, fid=None, **kwargs): return self.app.get( self.project.api_url_for( 'osfstorage_get_revisions', fid=fid or self.record._id, **signing.sign_data(signing.default_signer, {}) ), auth=self.user.auth, **kwargs )
def test_get_revisions_no_path(self): res = self.app.get( self.project.api_url_for( 'osf_storage_get_revisions', **signing.sign_data( signing.default_signer, {} ) ), auth=self.user.auth, expect_errors=True ) assert_equal(res.status_code, 400)
def func(name, *args, **kwargs): osfstorage = quickfiles.get_addon('osfstorage') root = osfstorage.get_root() url = '/api/v1/project/{}/osfstorage/{}/children/'.format( quickfiles._id, root._id) expect_errors = kwargs.pop('expect_errors', False) payload = make_payload(user=user, name=name, **kwargs) res = flask_app.post_json(url, signing.sign_data(signing.default_signer, payload), expect_errors=expect_errors) return res
def get_revisions(self, path=None, **kwargs): return self.app.get( self.project.api_url_for( 'osf_storage_get_revisions', **signing.sign_data( signing.default_signer, { 'path': path or self.record.path, } ) ), auth=self.user.auth, **kwargs )
def sign_payload(payload): return signing.sign_data(signing.default_signer, payload)