Пример #1
0
 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)
Пример #2
0
 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
     )
Пример #3
0
 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
     )
Пример #4
0
 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
     )
Пример #5
0
 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
Пример #7
0
 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
     )
Пример #8
0
 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
     )
Пример #9
0
    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)
Пример #10
0
 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
     )
Пример #11
0
 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)
Пример #12
0
    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
Пример #13
0
 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
     )
Пример #14
0
def sign_payload(payload):
    return signing.sign_data(signing.default_signer, payload)
Пример #15
0
def sign_payload(payload):
    return signing.sign_data(signing.default_signer, payload)