def test_get_ppa_file_key_ignores_bad_paths(self): # A path with extra path segments returns None, to indicate that # it should be ignored. self.assertIs( None, get_ppa_file_key( '/cprov/ppa/ubuntu/pool/main/aha/f/foo/foo_1.2.3-4_i386.deb')) self.assertIs(None, get_ppa_file_key('/foo'))
def test_get_ppa_file_key_normalises_path(self): archive_owner, archive_name, distro_name, filename = get_ppa_file_key( '/cprov/ppa/ubuntu/pool//main/f///foo/foo_1.2.3-4_i386.deb') self.assertEqual('cprov', archive_owner) self.assertEqual('ppa', archive_name) self.assertEqual('ubuntu', distro_name) self.assertEqual('foo_1.2.3-4_i386.deb', filename)
def test_get_ppa_file_key_ignores_non_binary_path(self): # A path pointing to a file not from a binary package returns # None to indicate that it should be ignored. self.assertIs( None, get_ppa_file_key( '/cprov/ppa/ubuntu/pool/main/f/foo/foo_1.2.3-4.dsc'))
def test_get_ppa_file_key_normalises_path(self): archive_owner, archive_name, distro_name, filename = get_ppa_file_key( '/cprov/ppa/ubuntu/pool//main/f///foo/foo_1.2.3-4_i386.deb') self.assertEqual('cprov', archive_owner) self.assertEqual('ppa', archive_name) self.assertEqual('ubuntu', distro_name) self.assertEqual('foo_1.2.3-4_i386.deb', filename)
def test_get_ppa_file_key_parses_good_paths(self): # A valid binary path results in archive, archive owner, # distribution and file names. archive_owner, archive_name, distro_name, filename = get_ppa_file_key( '/cprov/ppa/ubuntu/pool/main/f/foo/foo_1.2.3-4_i386.deb') self.assertEqual('cprov', archive_owner) self.assertEqual('ppa', archive_name) self.assertEqual('ubuntu', distro_name) self.assertEqual('foo_1.2.3-4_i386.deb', filename)
def test_get_ppa_file_key_parses_good_paths(self): # A valid binary path results in archive, archive owner, # distribution and file names. archive_owner, archive_name, distro_name, filename = get_ppa_file_key( '/cprov/ppa/ubuntu/pool/main/f/foo/foo_1.2.3-4_i386.deb') self.assertEqual('cprov', archive_owner) self.assertEqual('ppa', archive_name) self.assertEqual('ubuntu', distro_name) self.assertEqual('foo_1.2.3-4_i386.deb', filename)
def test_get_ppa_file_key_ignores_non_binary_path(self): # A path pointing to a file not from a binary package returns # None to indicate that it should be ignored. self.assertIs(None, get_ppa_file_key( '/cprov/ppa/ubuntu/pool/main/f/foo/foo_1.2.3-4.dsc'))
def test_get_ppa_file_key_ignores_bad_paths(self): # A path with extra path segments returns None, to indicate that # it should be ignored. self.assertIs(None, get_ppa_file_key( '/cprov/ppa/ubuntu/pool/main/aha/f/foo/foo_1.2.3-4_i386.deb')) self.assertIs(None, get_ppa_file_key('/foo'))
def getDownloadKey(self, path): """See `ParseApacheLogs`.""" return get_ppa_file_key(path)
def getDownloadKey(self, path): """See `ParseApacheLogs`.""" return get_ppa_file_key(path)