mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[IMP] tests: better tree-reading support
- add support for reading commit entries - add support for reading tree entries in non-recursive mode Previously the helper would only return blob entries, which does not allow testing submodule support.
This commit is contained in:
parent
a0e237fbfc
commit
5210cfb59f
14
conftest.py
14
conftest.py
@ -760,11 +760,15 @@ class Repo:
|
|||||||
# read tree's blobs
|
# read tree's blobs
|
||||||
tree = {}
|
tree = {}
|
||||||
for t in r.json()['tree']:
|
for t in r.json()['tree']:
|
||||||
if t['type'] != 'blob':
|
match t['type']:
|
||||||
continue # only keep blobs
|
case 'commit':
|
||||||
r = self._session.get('https://api.github.com/repos/{}/git/blobs/{}'.format(self.name, t['sha']))
|
tree[t['path']] = f"@{t['sha']}"
|
||||||
assert 200 <= r.status_code < 300, r.text
|
case 'blob':
|
||||||
tree[t['path']] = base64.b64decode(r.json()['content']).decode()
|
r = self._session.get('https://api.github.com/repos/{}/git/blobs/{}'.format(self.name, t['sha']))
|
||||||
|
assert 200 <= r.status_code < 300, r.text
|
||||||
|
tree[t['path']] = base64.b64decode(r.json()['content']).decode()
|
||||||
|
case 'tree' if not recursive:
|
||||||
|
tree[t['path']] = t['sha']
|
||||||
|
|
||||||
return tree
|
return tree
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user