def test_translate(self, realpath): realpath.side_effect = lambda p: os.path.normpath(p.upper()) table = AliasTable() table.table['A'] = '/tmp/test/path//a' table.table['B'] = '/tmp/test/path/b/' table.table['C'] = '/tmp/test///path/c' self.assertEqual(table.translate('A'), os.path.normpath(table.table['A']).upper()) self.assertEqual(table.translate('B'), os.path.normpath(table.table['B']).upper()) self.assertEqual(table.translate('C'), os.path.normpath(table.table['C']).upper())
def test_translate_not_found(self, realpath): realpath.side_effect = lambda p: os.path.normpath(p.upper()) table = AliasTable() path = '/my/unknown/path' self.assertEqual(table.translate(path), os.path.normpath(path).upper())