summaryrefslogtreecommitdiff
path: root/tools/python_test_v4.py
diff options
context:
space:
mode:
authorMax Wittig <max.wittig@siemens.com>2020-04-06 09:40:35 +0200
committerGitHub <noreply@github.com>2020-04-06 09:40:35 +0200
commitc161852b5a976d11f682c5af00ff3f4e8daa26ef (patch)
treecb2b89648e7f3678e0e6bfb47f60f77979296f99 /tools/python_test_v4.py
parentfa34f5e20ecbd3f5d868df2fa9e399ac6559c5d5 (diff)
parent847da6063b4c63c8133e5e5b5b45e5b4f004bdc4 (diff)
downloadgitlab-c161852b5a976d11f682c5af00ff3f4e8daa26ef.tar.gz
Merge pull request #1063 from python-gitlab/feat/group-import-export
Feat: support for group import/export API
Diffstat (limited to 'tools/python_test_v4.py')
-rw-r--r--tools/python_test_v4.py27
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