Adapt tests and rest_client to basic_auth

This commit is contained in:
Matthias
2019-05-25 14:25:36 +02:00
parent 2da7145132
commit febcc3dddc
2 changed files with 5 additions and 19 deletions

View File

@@ -7,6 +7,7 @@ from unittest.mock import ANY, MagicMock, PropertyMock
import pytest
from flask import Flask
from requests.auth import _basic_auth_str
from freqtrade.__init__ import __version__
from freqtrade.persistence import Trade
@@ -37,18 +38,14 @@ def botclient(default_conf, mocker):
def client_post(client, url, data={}):
headers = {"username": _TEST_USER,
"password": _TEST_PASS}
return client.post(url,
content_type="application/json",
data=data,
headers=headers)
headers={'Authorization': _basic_auth_str(_TEST_USER, _TEST_PASS)})
def client_get(client, url):
headers = {"username": _TEST_USER,
"password": _TEST_PASS}
return client.get(url, headers=headers)
return client.get(url, headers={'Authorization': _basic_auth_str(_TEST_USER, _TEST_PASS)})
def assert_response(response, expected_code=200):
@@ -95,8 +92,6 @@ def test_api_unauthorized(botclient):
assert rc.json == {'error': 'Unauthorized'}
def test_api_stop_workflow(botclient):
ftbot, client = botclient
assert ftbot.state == State.RUNNING