25 lines
818 B
Python
25 lines
818 B
Python
from fastapi import FastAPI
|
|
from fastapi.testclient import TestClient
|
|
from fastapi.staticfiles import StaticFiles
|
|
from app.workflows import views
|
|
|
|
|
|
def application():
|
|
app = FastAPI()
|
|
app.mount('/static', StaticFiles(directory='static'), name='static')
|
|
app.include_router(views.router)
|
|
return app
|
|
|
|
|
|
def test_operations_page_requires_authorized_user():
|
|
assert TestClient(application()).get('/workflows/operations').status_code == 401
|
|
|
|
|
|
def test_operations_page_renders_for_authorized_viewer():
|
|
app = application()
|
|
app.dependency_overrides[views.view_access] = lambda: {'id': 1}
|
|
response = TestClient(app).get('/workflows/operations')
|
|
assert response.status_code == 200
|
|
assert 'Workflowdrift' in response.text
|
|
assert 'Kontrollér og afstem eksisterende ordre' in response.text
|