Gitlab Community Edition Instance

Commit 686fe0ae authored by mhellka's avatar mhellka Committed by Marcel Hellkamp
Browse files

Added CDStar.archive_info, renamed CDStar.get_fileinfo to file_info

parent 51eac033
......@@ -148,6 +148,15 @@ class CDStar:
def vault_info(self, vault: str):
return'GET', vault)
def archive_info(self, vault, archive, meta=False, files=False):
""" Get information about an archive """
query = {"info": "true"}
if meta:
query.setdefault("with", []).append("meta")
if files:
query.setdefault("with", []).append("files")
return"GET", vault, archive, params=query)
def create_archive(self, vault, form: "FormUpdate" = None):
if form:
return"POST", vault, data=form.body,
......@@ -197,7 +206,7 @@ class CDStar:
headers = {'Range': "bytes={}-".format(offset)} if offset > 0 else {}
return self.raw("GET", vault, archive, _fix_filename(name), stream=True, headers=headers)
def get_fileinfo(self, vault, archive, name, meta=True):
def file_info(self, vault, archive, name, meta=False):
""" Get information about a file """
query = {"info": "true"}
if meta:
......@@ -62,7 +62,7 @@ def test_crud_file(): # pragma: no cover
r = c.put_file(VAULT, a['id'], "", fp, type="text/x-python")
assert r['digests']['md5'] == hash
assert r == c.get_fileinfo(VAULT, a['id'], "/", meta=False)
assert r == c.file_info(VAULT, a['id'], "/", meta=False)
assert "" == next(c.iter_files(VAULT, a['id']))['name']
fget = c.get_file(VAULT, a['id'], "")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment