def test_encode_decode(self):
     """Test encode and decode uuid."""
     self.assertEqual(encode_uuid(VOLUME_UUID), VOLUME_KEY)
     self.assertEqual(decode_uuid(VOLUME_KEY), VOLUME_UUID)
 def test_encode_decode(self):
     """Test encode and decode uuid."""
     self.assertEqual(encode_uuid(VOLUME_UUID), VOLUME_KEY)
     self.assertEqual(decode_uuid(VOLUME_KEY), VOLUME_UUID)
    decode_base62,
    decode_uuid,
    encode_base62,
    encode_uuid,
    get_keywords_from_path,
    get_node_public_key,
    get_public_file_url,
    make_nodekey,
    parse_nodekey,
    Base62Error,
    NodeKeyParseError,
)

VOLUME_UUID = uuid.UUID('157b4a51-2c88-4fe6-8ce3-08b98153054d')
NODE_UUID = uuid.UUID('5b64bc7e-0ac1-4da6-875b-a063bdd62bac')
VOLUME_KEY = encode_uuid(VOLUME_UUID)
NODE_KEY = encode_uuid(NODE_UUID)


class NodeKeyTests(unittest.TestCase):
    """Tests for the parse_nodekey() helper."""
    def test_encode_decode(self):
        """Test encode and decode uuid."""
        self.assertEqual(encode_uuid(VOLUME_UUID), VOLUME_KEY)
        self.assertEqual(decode_uuid(VOLUME_KEY), VOLUME_UUID)

    def test_make_parse_nodekey(self):
        """Test make and parse_nodekey."""
        key = make_nodekey(VOLUME_UUID, NODE_UUID)
        self.assertEqual(key, b'%s:%s' % (VOLUME_KEY, NODE_KEY))
        volume_id, node_id = parse_nodekey(key)
    decode_base62,
    decode_uuid,
    encode_base62,
    encode_uuid,
    get_keywords_from_path,
    get_node_public_key,
    get_public_file_url,
    make_nodekey,
    parse_nodekey,
    Base62Error,
    NodeKeyParseError,
)

VOLUME_UUID = uuid.UUID('157b4a51-2c88-4fe6-8ce3-08b98153054d')
NODE_UUID = uuid.UUID('5b64bc7e-0ac1-4da6-875b-a063bdd62bac')
VOLUME_KEY = encode_uuid(VOLUME_UUID)
NODE_KEY = encode_uuid(NODE_UUID)


class NodeKeyTests(unittest.TestCase):
    """Tests for the parse_nodekey() helper."""

    def test_encode_decode(self):
        """Test encode and decode uuid."""
        self.assertEqual(encode_uuid(VOLUME_UUID), VOLUME_KEY)
        self.assertEqual(decode_uuid(VOLUME_KEY), VOLUME_UUID)

    def test_make_parse_nodekey(self):
        """Test make and parse_nodekey."""
        key = make_nodekey(VOLUME_UUID, NODE_UUID)
        self.assertEqual(key, b'%s:%s' % (VOLUME_KEY, NODE_KEY))