def testMatchUrlMissingStartToken(self): """Verify no match when token_list lacks beginning of filename.""" self.token_list[0] = 'ghi' self.assertFalse(cb_url_lib.MatchUrl([self.filename], self.token_list))
def testMatchUrlMissingEndToken(self): """Verify no match when token_list lacks end of filename.""" self.token_list[1] = '.bi' self.assertFalse(cb_url_lib.MatchUrl([self.filename], self.token_list))
def testMatchUrlWithFullUrl(self): """Verify good match when input url is a full path.""" test_url = os.path.join('http://domain.com', self.filename) self.assertTrue(cb_url_lib.MatchUrl([test_url], self.token_list))
def testMatchUrlWithFilenameOnlyMixedCase(self): """Verify good match when input url is a filename (no path info).""" self.filename = 'aBcdEfgHI.biN' self.assertTrue(cb_url_lib.MatchUrl([self.filename], self.token_list))
def testMatchUrlEmptyTokenList(self): """Verify behavior when input token_list is empty.""" self.assertFalse(cb_url_lib.MatchUrl(['url'], []))
def testMatchUrlEmptyUrl(self): """Verify behavior when input url_list is empty.""" self.assertFalse(cb_url_lib.MatchUrl([], self.token_list))
def testManyMatches(self): """verify string returned upon multiple good matches.""" url_list = [self.filename, 'abc.bin', 'bdfhabc.bin'] actual = cb_url_lib.MatchUrl(url_list, self.token_list) self.assertEqual(self.filename, actual)
def testOneMatch(self): """Verify string returned upon a single good match.""" url_list = ['abd.bin', 'acd.bin', self.filename] actual = cb_url_lib.MatchUrl(url_list, self.token_list) self.assertEqual(self.filename, actual)
def testNoMatch(self): """Verify behavior when no match exists.""" url_list = ['abd.bin', 'acd.bin'] actual = cb_url_lib.MatchUrl(url_list, self.token_list) self.assertEqual(None, actual)