mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 15:35:46 +07:00
[IMP] *: move the page
helper fixture to the shared conftest
Use it in `test_limit` instead of direct `requests` calls.
This commit is contained in:
parent
1c76a675c2
commit
de32824a62
@ -385,6 +385,15 @@ def port():
|
||||
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
return s.getsockname()[1]
|
||||
|
||||
@pytest.fixture
|
||||
def page(port):
|
||||
with requests.Session() as s:
|
||||
def get(url):
|
||||
r = s.get('http://localhost:{}{}'.format(port, url))
|
||||
r.raise_for_status()
|
||||
return r.content
|
||||
yield get
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def dummy_addons_path():
|
||||
with tempfile.TemporaryDirectory() as dummy_addons_path:
|
||||
|
@ -1,5 +1,4 @@
|
||||
import pytest
|
||||
import requests
|
||||
|
||||
from utils import seen, Commit, make_basic, to_pr
|
||||
|
||||
@ -9,7 +8,7 @@ from utils import seen, Commit, make_basic, to_pr
|
||||
pytest.param('b', 'b', 0, id='current'),
|
||||
pytest.param('b', 'a', 0, id='earlier'),
|
||||
])
|
||||
def test_configure_fp_limit(env, config, make_repo, source, limit, count, port):
|
||||
def test_configure_fp_limit(env, config, make_repo, source, limit, count, page):
|
||||
prod, other = make_basic(env, config, make_repo, statuses="default")
|
||||
with prod:
|
||||
[c] = prod.make_commits(
|
||||
@ -35,15 +34,13 @@ def test_configure_fp_limit(env, config, make_repo, source, limit, count, port):
|
||||
assert not descendants.limit_id, "descendant should not inherit the limit explicitly"
|
||||
|
||||
# check that the basic thingie works
|
||||
r = requests.get(f'http://localhost:{port}/{prod.name}/pull/{pr.number}.png')
|
||||
assert r.ok, r.text
|
||||
page(f'/{prod.name}/pull/{pr.number}.png')
|
||||
|
||||
if descendants:
|
||||
c = env['runbot_merge.branch'].search([('name', '=', 'c')])
|
||||
descendants.limit_id = c.id
|
||||
|
||||
r = requests.get(f'http://localhost:{port}/{prod.name}/pull/{pr.number}.png')
|
||||
assert r.ok
|
||||
page(f'/{prod.name}/pull/{pr.number}.png')
|
||||
|
||||
def test_ignore(env, config, make_repo, users):
|
||||
""" Provide an "ignore" command which is equivalent to setting the limit
|
||||
|
@ -1,19 +1,9 @@
|
||||
import pytest
|
||||
import requests
|
||||
|
||||
@pytest.fixture()
|
||||
def module():
|
||||
return 'runbot_merge'
|
||||
|
||||
@pytest.fixture
|
||||
def page(port):
|
||||
s = requests.Session()
|
||||
def get(url):
|
||||
r = s.get('http://localhost:{}{}'.format(port, url))
|
||||
r.raise_for_status()
|
||||
return r.content
|
||||
return get
|
||||
|
||||
@pytest.fixture
|
||||
def default_crons():
|
||||
return [
|
||||
|
Loading…
Reference in New Issue
Block a user