def testCommunityUrlParams (self): url = 'http://community.livejournal.com/ljournal-ist/14774.html?format=light&style=mine' ljurl = LJUrl.parse (url) self.assertEqual (ljurl.username, 'ljournal-ist') self.assertEqual (ljurl.postid, 14774)
def testCommunityUrlParamsEmpty (self): url = 'http://community.livejournal.com/ljournal-ist/14774.html?' ljurl = LJUrl.parse (url) self.assertEqual (ljurl.username, 'ljournal-ist') self.assertEqual (ljurl.postid, 14774)
def testUserUrlParams (self): url = 'http://users.livejournal.com/___lin___/254416.html?format=light&style=mine' ljurl = LJUrl.parse (url) self.assertEqual (ljurl.username, '___lin___') self.assertEqual (ljurl.postid, 254416) self.assertEqual (ljurl.pureUrl, 'http://users.livejournal.com/___lin___/254416.html')
def testCommunityUrl (self): url = 'http://community.livejournal.com/ljournalist/123456.html' ljurl = LJUrl.parse (url) self.assertEqual (ljurl.username, 'ljournalist') self.assertEqual (ljurl.postid, 123456)
def testSimpleUrlParamsEmpty (self): url = 'http://user-name.livejournal.com/123456.html?' ljurl = LJUrl.parse (url) self.assertEqual (ljurl.username, 'user-name') self.assertEqual (ljurl.postid, 123456)
def testSimpleUrlParams (self): url = 'http://user-name.livejournal.com/123456.html?format=light&style=mine' ljurl = LJUrl.parse (url) self.assertEqual (ljurl.username, 'user-name') self.assertEqual (ljurl.postid, 123456)
def testPureUrl2 (self): url = 'http://community.livejournal.com/ljournal-ist/14774.html?format=light&style=mine' ljurl = LJUrl.parse (url) pureUrl = ljurl.pureUrl self.assertEqual (pureUrl, 'http://ljournal-ist.livejournal.com/14774.html')
def testPureUrl1 (self): url = 'http://user-name.livejournal.com/123456.html?format=light&style=mine' ljurl = LJUrl.parse (url) pureUrl = ljurl.pureUrl self.assertEqual (pureUrl, 'http://user-name.livejournal.com/123456.html')
def testUserUrl (self): url = 'http://users.livejournal.com/___lin___/254416.html' ljurl = LJUrl.parse (url) self.assertEqual (ljurl.username, '___lin___') self.assertEqual (ljurl.postid, 254416)