예제 #1
0
 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))
예제 #2
0
 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))
예제 #3
0
 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))
예제 #4
0
 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))
예제 #5
0
 def testMatchUrlEmptyTokenList(self):
     """Verify behavior when input token_list is empty."""
     self.assertFalse(cb_url_lib.MatchUrl(['url'], []))
예제 #6
0
 def testMatchUrlEmptyUrl(self):
     """Verify behavior when input url_list is empty."""
     self.assertFalse(cb_url_lib.MatchUrl([], self.token_list))
예제 #7
0
 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)
예제 #8
0
 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)
예제 #9
0
 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)