Exemplo n.º 1
0
 def test_schemes_with_plus(self):
     self.assertEqual(
         ('https://endpoint/', '123'),
         shaman.parse_endpoint('shaman+https://endpoint/#123'),
     )
     self.assertEqual(
         ('http://endpoint/', '123'),
         shaman.parse_endpoint('shaman+http://endpoint/#123'),
     )
Exemplo n.º 2
0
    def test_checkout_ids(self):
        self.assertEqual(
            ('https://endpoint/', ''),
            shaman.parse_endpoint('shaman+https://endpoint/'),
        )

        # Not a valid ID, but the parser should handle it gracefully anyway
        self.assertEqual(
            ('http://endpoint/', 'ïđ'),
            shaman.parse_endpoint('shaman+http://endpoint/#%C3%AF%C4%91'),
        )
Exemplo n.º 3
0
 def test_path_slashyness(self):
     self.assertEqual(
         ('https://endpoint/', '123'),
         shaman.parse_endpoint('shaman://endpoint#123'),
     )
     self.assertEqual(
         ('https://endpoint/', '123'),
         shaman.parse_endpoint('shaman://endpoint/#123'),
     )
     self.assertEqual(
         ('https://endpoint/root', '123'),
         shaman.parse_endpoint('shaman://endpoint/root#123'),
     )
     self.assertEqual(
         ('https://endpoint/root/is/longer/', '123'),
         shaman.parse_endpoint('shaman://endpoint/root/is/longer/#123'),
     )
Exemplo n.º 4
0
def create_shamanpacker(bpath: pathlib.Path, ppath: pathlib.Path,
                        tpath: str) -> pack.Packer:
    """Creates a package for sending files to a Shaman server.

    URLs should have the form:
        shaman://hostname/base/url#jobID
    This uses HTTPS to connect to the server. To connect using HTTP, use:
        shaman+http://hostname/base-url#jobID
    """
    from blender_asset_tracer.pack import shaman

    endpoint, checkout_id = shaman.parse_endpoint(tpath)
    if not checkout_id:
        log.warning(
            'No checkout ID given on the URL. Going to send BAT pack to Shaman, '
            'but NOT creating a checkout')

    log.info('Uploading to Shaman server %s with job %s', endpoint,
             checkout_id)
    return shaman.ShamanPacker(bpath,
                               ppath,
                               '/',
                               endpoint=endpoint,
                               checkout_id=checkout_id)