apply auth requirement to virtually all endpoints
This commit is contained in:
@@ -32,6 +32,7 @@ class TestPENumberInForm:
|
||||
def _set_monkeypatches(self, monkeypatch):
|
||||
monkeypatch.setattr("atst.forms.financial.FinancialForm.validate", lambda s: True)
|
||||
monkeypatch.setattr("atst.domain.requests.Requests.get", lambda i: MOCK_REQUEST)
|
||||
monkeypatch.setattr("atst.domain.auth.get_current_user", lambda *args: MOCK_USER)
|
||||
|
||||
def submit_data(self, client, data):
|
||||
response = client.post(
|
||||
|
@@ -15,7 +15,8 @@ MOCK_REQUEST = RequestFactory.create(
|
||||
)
|
||||
|
||||
|
||||
def test_submit_invalid_request_form(monkeypatch, client):
|
||||
def test_submit_invalid_request_form(monkeypatch, client, user_session):
|
||||
user_session()
|
||||
response = client.post(
|
||||
"/requests/new/1",
|
||||
headers={"Content-Type": "application/x-www-form-urlencoded"},
|
||||
@@ -24,7 +25,8 @@ def test_submit_invalid_request_form(monkeypatch, client):
|
||||
assert re.search(ERROR_CLASS, response.data.decode())
|
||||
|
||||
|
||||
def test_submit_valid_request_form(monkeypatch, client):
|
||||
def test_submit_valid_request_form(monkeypatch, client, user_session):
|
||||
user_session()
|
||||
monkeypatch.setattr("atst.forms.request.RequestForm.validate", lambda s: True)
|
||||
|
||||
response = client.post(
|
||||
|
@@ -7,7 +7,8 @@ def _mock_func(*args, **kwargs):
|
||||
return RequestFactory.create()
|
||||
|
||||
|
||||
def test_submit_reviewed_request(monkeypatch, client):
|
||||
def test_submit_reviewed_request(monkeypatch, client, user_session):
|
||||
user_session()
|
||||
monkeypatch.setattr("atst.domain.requests.Requests.get", _mock_func)
|
||||
monkeypatch.setattr("atst.domain.requests.Requests.submit", _mock_func)
|
||||
monkeypatch.setattr("atst.models.request.Request.status", "pending")
|
||||
@@ -22,7 +23,8 @@ def test_submit_reviewed_request(monkeypatch, client):
|
||||
assert "modal" not in response.headers["Location"]
|
||||
|
||||
|
||||
def test_submit_autoapproved_reviewed_request(monkeypatch, client):
|
||||
def test_submit_autoapproved_reviewed_request(monkeypatch, client, user_session):
|
||||
user_session()
|
||||
monkeypatch.setattr("atst.domain.requests.Requests.get", _mock_func)
|
||||
monkeypatch.setattr("atst.domain.requests.Requests.submit", _mock_func)
|
||||
monkeypatch.setattr("atst.models.request.Request.status", "approved")
|
||||
|
Reference in New Issue
Block a user