def test_find_all_if_does_not_exist(self): finder = FileSystemFinder(('/first', '/second', '/third')) finder.find_location = Mock(return_value=False) self.assertEqual(list(finder.find_all('js/script.js')), []) self.assertEqual(finder.find_location.call_args_list, [(('/first', 'js/script.js'), {}), (('/second', 'js/script.js'), {}), (('/third', 'js/script.js'), {})])
def test_find_all_if_does_not_exist(self): finder = FileSystemFinder(('/first', '/second', '/third')) finder.find_location = Mock(return_value=False) self.assertEqual(list(finder.find_all('js/script.js')), []) self.assertEqual(finder.find_location.call_args_list, [ (('/first', 'js/script.js'), {}), (('/second', 'js/script.js'), {}), (('/third', 'js/script.js'), {})])
def test_find_all_if_does_not_exist(self): finder = FileSystemFinder(("/first", "/second", "/third")) finder.find_location = Mock(return_value=False) self.assertEqual(list(finder.find_all("js/script.js")), []) self.assertEqual( finder.find_location.call_args_list, [(("/first", "js/script.js"), {}), (("/second", "js/script.js"), {}), (("/third", "js/script.js"), {})], )
def test_find_all_if_exists(self): def find_location(root, path): if root != "/first": return os.path.join(root, path) finder = FileSystemFinder(("/first", "/second", "/third")) finder.find_location = Mock(side_effect=find_location) paths = list(finder.find_all("js/script.js")) self.assertEqual(paths, ["/second/js/script.js", "/third/js/script.js"]) self.assertEqual( finder.find_location.call_args_list, [(("/first", "js/script.js"), {}), (("/second", "js/script.js"), {}), (("/third", "js/script.js"), {})], )
def test_find_all_if_exists(self): def find_location(root, path): if root != '/first': return os.path.join(root, path) finder = FileSystemFinder(('/first', '/second', '/third')) finder.find_location = Mock(side_effect=find_location) paths = list(finder.find_all('js/script.js')) self.assertEqual(paths, ['/second/js/script.js', '/third/js/script.js']) self.assertEqual(finder.find_location.call_args_list, [(('/first', 'js/script.js'), {}), (('/second', 'js/script.js'), {}), (('/third', 'js/script.js'), {})])
def test_find_all_if_exists(self): def find_location(root, path): if root != '/first': return os.path.join(root, path) finder = FileSystemFinder(('/first', '/second', '/third')) finder.find_location = Mock(side_effect=find_location) paths = list(finder.find_all('js/script.js')) self.assertEqual(paths, ['/second/js/script.js', '/third/js/script.js']) self.assertEqual(finder.find_location.call_args_list, [ (('/first', 'js/script.js'), {}), (('/second', 'js/script.js'), {}), (('/third', 'js/script.js'), {})])
def test_find_location_if_does_not_exist(self, exists): exists.return_value = False finder = FileSystemFinder(('/assets', )) self.assertIsNone(finder.find_location('/assets', 'js/script.js')) exists.assert_called_once_with('/assets/js/script.js')
def test_find_location_if_exists(self, exists): exists.return_value = True finder = FileSystemFinder(('/assets', )) location = finder.find_location('/assets', 'js/script.js') self.assertEqual(location, '/assets/js/script.js') exists.assert_called_once_with('/assets/js/script.js')
def test_find_location_if_does_not_exist(self, exists): exists.return_value = False finder = FileSystemFinder(('/assets',)) self.assertIsNone(finder.find_location('/assets', 'js/script.js')) exists.assert_called_once_with('/assets/js/script.js')
def test_find_location_if_exists(self, exists): exists.return_value = True finder = FileSystemFinder(('/assets',)) location = finder.find_location('/assets', 'js/script.js') self.assertEqual(location, '/assets/js/script.js') exists.assert_called_once_with('/assets/js/script.js')