Skip to content
代码片段 群组 项目
提交 6f1c8c28 编辑于 作者: Heinrich Lee Yu's avatar Heinrich Lee Yu
浏览文件

Merge branch 'rodrigo/remove-project-owner-from-import-export' into 'master'

Refactor Import/Export spec to not use project.owner

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/111987



Merged-by: default avatarHeinrich Lee Yu <heinrich@gitlab.com>
Approved-by: default avatarHeinrich Lee Yu <heinrich@gitlab.com>
Approved-by: default avatarEugenia Grieff <egrieff@gitlab.com>
Co-authored-by: default avatarRodrigo Tomonari <rtomonari@gitlab.com>
No related branches found
No related tags found
无相关合并请求
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
end end
it 'yields the initial tree when importing and exporting it again' do it 'yields the initial tree when importing and exporting it again' do
project = create(:project, creator: create(:user, :admin)) project = create(:project)
user = create(:user, :admin)
# We first generate a test fixture dynamically from a seed-fixture, so as to # We first generate a test fixture dynamically from a seed-fixture, so as to
# account for any fields in the initial fixture that are missing and set to # account for any fields in the initial fixture that are missing and set to
...@@ -34,6 +35,7 @@ ...@@ -34,6 +35,7 @@
expect( expect(
restore_then_save_project( restore_then_save_project(
project, project,
user,
import_path: seed_fixture_path, import_path: seed_fixture_path,
export_path: test_fixture_path) export_path: test_fixture_path)
).to be true ).to be true
...@@ -42,6 +44,7 @@ ...@@ -42,6 +44,7 @@
expect( expect(
restore_then_save_project( restore_then_save_project(
project, project,
user,
import_path: test_fixture_path, import_path: test_fixture_path,
export_path: test_tmp_path) export_path: test_tmp_path)
).to be true ).to be true
......
...@@ -51,22 +51,22 @@ def get_json(path, exportable_path, key, ndjson_enabled) ...@@ -51,22 +51,22 @@ def get_json(path, exportable_path, key, ndjson_enabled)
json json
end end
def restore_then_save_project(project, import_path:, export_path:) def restore_then_save_project(project, user, import_path:, export_path:)
project_restorer = get_project_restorer(project, import_path) project_restorer = get_project_restorer(project, user, import_path)
project_saver = get_project_saver(project, export_path) project_saver = get_project_saver(project, user, export_path)
project_restorer.restore && project_saver.save project_restorer.restore && project_saver.save
end end
def get_project_restorer(project, import_path) def get_project_restorer(project, user, import_path)
Gitlab::ImportExport::Project::TreeRestorer.new( Gitlab::ImportExport::Project::TreeRestorer.new(
user: project.creator, shared: get_shared_env(path: import_path), project: project user: user, shared: get_shared_env(path: import_path), project: project
) )
end end
def get_project_saver(project, export_path) def get_project_saver(project, user, export_path)
Gitlab::ImportExport::Project::TreeSaver.new( Gitlab::ImportExport::Project::TreeSaver.new(
project: project, current_user: project.creator, shared: get_shared_env(path: export_path) project: project, current_user: user, shared: get_shared_env(path: export_path)
) )
end end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册