mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[ADD] tests: support creating repos without webhooks
Most of the repos we create we want to hook into the odoo instance, but in some rare cases we want repositories for just push/pull, in that case webhooks configuration just creates log noise (as the events get rejected on intake).
This commit is contained in:
parent
5210cfb59f
commit
7eeeb18af4
25
conftest.py
25
conftest.py
@ -558,7 +558,7 @@ def make_repo(request, config, tunnel, users):
|
|||||||
assert r.json()['login'] == owner
|
assert r.json()['login'] == owner
|
||||||
|
|
||||||
repos = []
|
repos = []
|
||||||
def repomaker(name):
|
def repomaker(name, *, hooks=True):
|
||||||
name = 'ignore_%s_%s' % (name, base64.b64encode(os.urandom(6), b'-_').decode())
|
name = 'ignore_%s_%s' % (name, base64.b64encode(os.urandom(6), b'-_').decode())
|
||||||
fullname = '{}/{}'.format(owner, name)
|
fullname = '{}/{}'.format(owner, name)
|
||||||
repo_url = 'https://api.github.com/repos/{}'.format(fullname)
|
repo_url = 'https://api.github.com/repos/{}'.format(fullname)
|
||||||
@ -584,17 +584,18 @@ def make_repo(request, config, tunnel, users):
|
|||||||
|
|
||||||
repo = Repo(github, fullname, repos)
|
repo = Repo(github, fullname, repos)
|
||||||
|
|
||||||
# create webhook
|
if hooks:
|
||||||
check(github.post('{}/hooks'.format(repo_url), json={
|
# create webhook
|
||||||
'name': 'web',
|
check(github.post('{}/hooks'.format(repo_url), json={
|
||||||
'config': {
|
'name': 'web',
|
||||||
'url': '{}/runbot_merge/hooks'.format(tunnel),
|
'config': {
|
||||||
'content_type': 'json',
|
'url': '{}/runbot_merge/hooks'.format(tunnel),
|
||||||
'insecure_ssl': '1',
|
'content_type': 'json',
|
||||||
},
|
'insecure_ssl': '1',
|
||||||
'events': ['pull_request', 'issue_comment', 'status', 'pull_request_review']
|
},
|
||||||
}))
|
'events': ['pull_request', 'issue_comment', 'status', 'pull_request_review']
|
||||||
time.sleep(1)
|
}))
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
check(github.put('{}/contents/{}'.format(repo_url, 'a'), json={
|
check(github.put('{}/contents/{}'.format(repo_url, 'a'), json={
|
||||||
'path': 'a',
|
'path': 'a',
|
||||||
|
Loading…
Reference in New Issue
Block a user