diff options
author | Nejc Habjan <hab.nejc@gmail.com> | 2020-04-05 22:58:04 +0200 |
---|---|---|
committer | Nejc Habjan <hab.nejc@gmail.com> | 2020-04-05 22:58:04 +0200 |
commit | e7b2d6c873f0bfd502d06c9bd239cedc465e51c5 (patch) | |
tree | b3ce19f49fbbb4dcecd7cee8a32f02ed80f823b2 /tools | |
parent | 6cb9d9238ea3cc73689d6b71e991f2ec233ee8e6 (diff) | |
download | gitlab-e7b2d6c873f0bfd502d06c9bd239cedc465e51c5.tar.gz |
test(api): add tests for group export/import API
Diffstat (limited to 'tools')
-rw-r--r-- | tools/python_test_v4.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/python_test_v4.py b/tools/python_test_v4.py index e0cb3a6..076329b 100644 --- a/tools/python_test_v4.py +++ b/tools/python_test_v4.py @@ -380,6 +380,33 @@ assert len(group1.variables.list()) == 0 # g_l.delete() # assert len(group1.labels.list()) == 0 + +# group import/export +export = group1.exports.create() +assert export.message == "202 Accepted" + +# We cannot check for export_status with group export API +time.sleep(10) + +import_archive = "/tmp/gitlab-group-export.tgz" +import_path = "imported_group" +import_name = "Imported Group" + +with open(import_archive, "wb") as f: + export.download(streamed=True, action=f.write) + +with open(import_archive, "rb") as f: + output = gl.groups.import_group(f, import_path, import_name) +assert output["message"] == "202 Accepted" + +# We cannot check for returned ID with group import API +time.sleep(10) +group_import = gl.groups.get(import_path) + +assert group_import.path == import_path +assert group_import.name == import_name + + # hooks hook = gl.hooks.create({"url": "http://whatever.com"}) assert len(gl.hooks.list()) == 1 |