def test_shareURLCloneMaintainsShareID(self): """ Test that L{xmantissa.websharing._ShareURL} can be cloned, and that clones will remember the share ID. """ shareURL = websharing._ShareURL(u'a', netloc='', scheme='') shareURL = shareURL.cloneURL('', '', None, None, '') self.assertEqual(shareURL._shareID, u'a')
def test_shareURLNoStoreID(self): """ Test that L{xmantissa.websharing._ShareURL} behaves like a regular L{nevow.url.URL} when no store ID is passed. """ shareURL = websharing._ShareURL(None, netloc='', scheme='') self.assertEqual(str(shareURL.child('a')), '/a') self.assertEqual(str(shareURL.child('a').child('b')), '/a/b')
def test_shareURLInjectsShareID(self): """ Test that L{xmantissa.websharing._ShareURL} injects the share ID the constructor is passed when C{child} is called. """ for (shareID, urlID) in [(u'a', 'a'), (u'\xe9', '%C3%A9')]: shareURL = websharing._ShareURL(shareID, netloc='', scheme='') self.assertEqual(str(shareURL.child('c')), '/%s/c' % urlID) # make sure subsequent child calls on the original have the same # behaviour self.assertEqual(str(shareURL.child('d')), '/%s/d' % urlID) # and that child calls on the returned urls don't (i.e. not # '/a/c/a/d' self.assertEqual(str(shareURL.child('c').child('d')), '/%s/c/d' % urlID)