Example #1
0
    def upload_resource(self, resource_file, dataset_id, lfs_namespace,
                        filename):
        # type: (str, str, str, str) -> ObjectAttributes
        """Upload a resource file to new storage using LFS server
        """
        token = self.get_upload_authz_token(dataset_id)
        lfs_client = LfsClient(helpers.server_url(), token)
        with open(resource_file, 'rb') as f:
            props = lfs_client.upload(f,
                                      lfs_namespace,
                                      dataset_id,
                                      filename=filename)

        # Only return standard object attributes
        return {k: v for k, v in props.items() if k[0:2] != 'x-'}
def test_server_url_from_config():
    assert 'https://foo.example.com/lfs' == helpers.server_url()
def test_server_url_strip_trailing_slash():
    assert 'https://foo.example.com/lfs' == helpers.server_url()