def test_bundle_parse_directory_ignored_path(patch, bundle): patch.object( os, "walk", return_value=[(os.path.join(".", "root"), [], ["one.story"])], ) patch.many(Bundle, ["gitignores", "ignores"]) Bundle.gitignores.return_value = [] Bundle.parse_directory("dir", ignored_path="ignored") Bundle.ignores.assert_called_with("ignored")
def test_bundle_parse_directory_gitignored(patch, bundle): """ Ensures parse_directory does not return gitignored files """ patch.object(os, 'walk', return_value=[('./root', [], ['one.story'])]) patch.object(Bundle, 'gitignores') Bundle.gitignores.return_value = ['root/one.story'] assert Bundle.parse_directory('dir') == []
def test_bundle_parse_directory(patch, bundle): """ Ensures parse_directory can parse a directory """ patch.object(os, 'walk', return_value=[('root', [], ['one.story', 'two'])]) patch.object(Bundle, 'gitignores') result = Bundle.parse_directory('dir') assert Bundle.gitignores.call_count == 1 os.walk.assert_called_with('dir') assert result == ['root/one.story']
def test_bundle_parse_directory(patch, bundle): """ Ensures parse_directory can parse a directory """ patch.object(os, "walk", return_value=[("root", [], ["one.story", "two"])]) patch.object(Bundle, "gitignores") result = Bundle.parse_directory("dir") assert Bundle.gitignores.call_count == 1 os.walk.assert_called_with("dir") assert result == [os.path.join("root", "one.story")]
def test_bundle_parse_directory_gitignored(patch, bundle): """ Ensures parse_directory does not return gitignored files """ patch.object( os, "walk", return_value=[(os.path.join(".", "root"), [], ["one.story"])], ) patch.object(Bundle, "gitignores") Bundle.gitignores.return_value = [os.path.join("root", "one.story")] assert Bundle.parse_directory("dir") == []
def test_bundle_parse_directory_ignored_path(patch, bundle): patch.object(os, 'walk', return_value=[('./root', [], ['one.story'])]) patch.many(Bundle, ['gitignores', 'ignores']) Bundle.gitignores.return_value = [] Bundle.parse_directory('dir', ignored_path='ignored') Bundle.ignores.assert_called_with('ignored')