'Test RDFURN handling.'

def testRDFURN(self):

    str_url = 'aff4:/hunts/W:AAAAAAAA/Results'
    url = rdfvalue.RDFURN(str_url, age=1)
    self.assertEqual(url.age, 1)
    self.assertEqual(url.Path(), '/hunts/W:AAAAAAAA/Results')
    self.assertEqual(str(url), str_url)
    self.assertEqual(url.scheme, 'aff4')
    url = url.Add('some', age=2).Add('path', age=3)
    self.assertEqual(url.age, 3)
    self.assertEqual(url.Path(), '/hunts/W:AAAAAAAA/Results/some/path')
    self.assertEqual(str(url), utils.Join(str_url, 'some', 'path'))
    str_url = 'aff4:/C.0000000000000000/fs/os/c/regex.*?]&[+{}--'
    url = rdfvalue.RDFURN(str_url, age=1)
    self.assertEqual(url.Path(), str_url[5:])
    for path in ['aff4:/test/?#asd', 'aff4:/test/#asd', 'aff4:/test/?#']:
        self.assertEqual(path, str(rdfvalue.RDFURN(path)))
