tests: adapt mocked requests.get to accept all args (#30052)
This commit is contained in:
parent
c6d4361d84
commit
6b6f4dc4b3
|
@ -28,7 +28,7 @@ def services(request):
|
|||
def test_response(app, admin_user, services, monkeypatch):
|
||||
cache.clear()
|
||||
monkeypatch.setattr(socket, 'gethostbyname', lambda x: '176.31.123.109')
|
||||
monkeypatch.setattr(requests, 'get', lambda x, verify: MagicMock(status_code=200))
|
||||
monkeypatch.setattr(requests, 'get', lambda x, *args, **kwargs: MagicMock(status_code=200))
|
||||
response = app.get('/api/health/')
|
||||
assert response.status_code == 200
|
||||
content = json.loads(response.content)
|
||||
|
@ -44,7 +44,7 @@ def test_is_resolvable(app, admin_user, services, monkeypatch):
|
|||
else:
|
||||
raise socket.gaierror
|
||||
monkeypatch.setattr(socket, 'gethostbyname', gethostname)
|
||||
monkeypatch.setattr(requests, 'get', lambda x, verify: MagicMock(status_code=200))
|
||||
monkeypatch.setattr(requests, 'get', lambda x, *args, **kwargs: MagicMock(status_code=200))
|
||||
response = app.get('/api/health/')
|
||||
content = json.loads(response.content)
|
||||
blues = content['data']['blues']
|
||||
|
@ -91,7 +91,7 @@ def test_is_running(app, admin_user, services, monkeypatch):
|
|||
def test_is_operational(app, admin_user, services, monkeypatch):
|
||||
cache.clear()
|
||||
monkeypatch.setattr(socket, 'gethostbyname', lambda x: '176.31.123.109')
|
||||
monkeypatch.setattr(requests, 'get', lambda x, verify: MagicMock(status_code=200))
|
||||
monkeypatch.setattr(requests, 'get', lambda x, *args, **kwargs: MagicMock(status_code=200))
|
||||
response = app.get('/api/health/')
|
||||
content = json.loads(response.content)
|
||||
blues = content['data']['blues']
|
||||
|
@ -102,7 +102,7 @@ def test_is_operational(app, admin_user, services, monkeypatch):
|
|||
|
||||
def test_has_valid_certificate(app, admin_user, services, monkeypatch):
|
||||
cache.clear()
|
||||
def get(url, verify):
|
||||
def get(url, verify, *args, **kwargs):
|
||||
if 'blues.example.publik' in url or not verify:
|
||||
return MagicMock(status_code=200)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue