fix tests
continuous-integration/drone/push Build is failing Details

This commit is contained in:
James Ravenscroft 2022-10-22 12:03:03 +01:00
parent 81ccdc0fbb
commit f5dfdfdca8
2 changed files with 7 additions and 3 deletions

View File

@ -39,7 +39,7 @@ def create_app():
app.config.from_file(os.path.join(os.getcwd(), "config.yaml"), yaml.safe_load)
from .micropub import micropub, auth_bp
from .indieauth import micropub, auth_bp
from .webmentions import webhook_bp
print(app.config)

View File

@ -27,7 +27,9 @@ def test_no_token_request(mocker):
rget = mocker.patch('microcosm.requests.get')
with microcosm.app.test_client() as c:
app = microcosm.create_app()
with app.test_client() as c:
response = c.get("/")
assert response.status_code == 401
assert response.json.get("error") == "unauthorized"
@ -41,7 +43,9 @@ def test_invalid_token_request(mocker):
rget = mocker.patch('microcosm.requests.get', side_effect=expect_json_response({"me":"https://someothersite.com/"}))
with microcosm.app.test_client() as c:
app = microcosm.create_app()
with app.test_client() as c:
response = c.get("/", headers={'Authorization': 'Bearer SomeTestTokenValue'})
assert response.status_code == 401
assert response.json.get("error") == "insufficient_scope"